Standard ADO.Net components works with ES?


Author
Message
Luiz Lima
Luiz Lima
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 66, Visits: 724
Hi,



I´d like to know if the code below works when I using a ES connection.



Tks



con = New SqlConnection(sConnectionString)

con.Open()

ds = New DataSet()

sSql = "select cli_campo01, cli_campo02, cli_classe, cli_nome from tb_cliente "

dap = New SqlDataAdapter(sSql, con)

Dim dt = New DataTable()

dap.Fill(dt)

If dt.Rows.Count > 0 Then

dim campo1 as string = dt.Rows(0).Item("server_cliente")

dim campo2 as string = dt.Rows(0).Item("db_cliente")

classe_cliente = dt.Rows(0).Item("cli_classe")

nome_cliente = dt.Rows(0).Item("cli_nome")

end if


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
As far as I know, no it won't. It only deals with BOs. I know when I started using ES, I had to redo a couple of things that were using ADO.NET directly.



Note that you can use a generic BO, or even the BusinessLayer directly to get a Datatable filled:



'-- Use a generic BusinessLayer to fill a datatable and get some arbitrary data.

Dim campo1 As String = String.Empty

Dim campo2 As String = String.Empty

Using bo As New BusinessLayer()

  '-- Set data source key, so it can find data.

  bo.DataSourceKey = ""



  '-- Fill BO's data table using a SQL command...could just use the String overload

  '   but if you are passing params, then this is the way to go.

  Using cmd As New SqlCommand()

    cmd.CommandText = "select cli_campo01, cli_campo02, cli_classe, cli_nome from tb_cliente "

    bo.FillDataTable(cmd)

  End Using



  '-- If there are any items, load data. It'll be on the first row by default.

  '   If you need to move to another row, BO has methods to get this done.

  If bo.Count > 0 Then

    campo1 = Ctype(bo.CurrentRow("server_cliente"), String)

    campo2 = Ctype(bo.CurrentRow("db_cliente"), String)

    classe_cliente = Ctype(bo.CurrentRow("cli_classe"), String)

    nome_cliente = Ctype(bo.CurrentRow("cli_nome"), String)

  End If

End Using

Luiz Lima
Luiz Lima
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 66, Visits: 724
Greg,

Fantastic!
I didn´t know the use of generic BO, this open a large of possibilities to me.
Can I use this generic BO with Business Binding Source?

Tks!

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Not sure about that, but it might be possible. I'm not sure how the BBS does its "magic", if it uses the field properties or just whatever datatable is loaded into the BO. If it's just using the data table, then I'm guessing this would work.
Luiz Lima
Luiz Lima
StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)StrataFrame User (134 reputation)
Group: Forum Members
Posts: 66, Visits: 724
Greg,

Sorry by late.
I tested the code but I´ve got an error about override TableName, how can I do that?

See the screen shot


tks

Luiz

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Oops. I haven't done this in a while. You have actually build a BO using the BO mapper so all the required override properties are handled. I guess a better way of expressing this is to say that you can use any BO to generically retrieve data. I'm working on an example which should be done tomorrow.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I just posted a sample demonstrating how you might do this.



http://forum.strataframe.net/FindPost26800.aspx
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Great job, Greg. Thanks for the samples! Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search