|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need to retrieve resultset from datareader
Hello all,
I am in need to populate a datalist with a compound select querry, I am not retreaving alot of data,, only a couple of fields from three tables,, however, one of the tables i am not able to inner join on.. so i am looking for some help here on how to iteriate through a datareader and pull the two resultsets from the reader and not just one.. from the time that i have spent on this little issue it is apparent that the reader will loop the first result and not notice the second result.. Surely there is a way to retrieve this data so that i can use it in a datalist.. Below is how i would like to implement this with a datalist (to some degree,, this is just a simple example so that i can get some desperately needed help on this) Looking for all help and ideas here.. i am very much open to all ideas. ======================================= Here is the SPROC ALTER procedure Data_Reader AS SELECT Employees.LastName FROM Employees SELECT Customers.CompanyName FROM CUSTOMERS ============================================= This works great with ddls... Can have 100 table if desired and with little to no code fill all the ddl you want to.. Dim cnn As New SqlConnection("data source = desktop; initial catalog= northwind; trusted_connection=true") cnn.Open() ' Dim cmd As New SqlCommand("Data_Reader", cnn) cmd.CommandType = CommandType.StoredProcedure Dim dr As SqlDataReader dr = cmd.ExecuteReader With ddlLastName .DataSource = dr .DataTextField = "LastName" .DataValueField = "LastName" .DataBind() End With dr.NextResult() With ddlCompanyName .DataSource = dr .DataTextField = "CompanyName" .DataValueField = "CompanyName" .DataBind() End With cnn.Close() dr.Close() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Need to retrieve resultset from datareader |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|