Link to home
Start Free TrialLog in
Avatar of msyed1
msyed1

asked on

Bind Data to Datagrid from Multiple Sources

Hello,
I have a Search application that performs Search and displays results in a datagrid.  The search has to be done against two different databases.   My 1st datasource is a dataset, but my 2nd datasource is an arraylist (but exactly in the same order that the datagrid expects it to be).  I am not sure how to assign the 2nd datasource to the dataadapter, and then bind the two at one time, so when the datagrid is displayed, the results from the two sources display as one.

I need ideas and examples (VB.Net).  Should I combine the results from the first datasource with the 2nd and Bind at one time or can I do a 2nd Bind after the first Bind ?  Here is my first Bind code.  

If I need to I can create the 2nd datasource as a dataset also, if that is more advisable.....    


            ''''' Create Adapter and pass the SQL string
            Dim daTPCSSearchResults As New System.Data.SqlClient.SqlDataAdapter(strBuildString, TPCSConnection)
            Dim ds As New DataSet
            daTPCSSearchResults.Fill(ds)

            dgTPCSSearchResults.DataBind()


Avatar of surajguptha
surajguptha
Flag of United States of America image

I dont think it is possible to bind twice because the second bind would remove all the data from the first bind. i would suggest you to convert the results from the first datasource to a datatable and the second datasource to a datatable, add the rows from the first datatable to the second.

or if both the datatables have a different format, just convert them both to a same format datatable
ASKER CERTIFIED SOLUTION
Avatar of Mgreenway
Mgreenway

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial