how can we display records in single datagrid using two
datasets in different place?

Answer Posted / ruby

we can do it using merge method of dataset.
but for that bot the tables must have same no. of columns , same fields and their respective datatypes.

also both the data table's name must be same("Table1" of both the datasets)

Sub BindGrid()
Dim myConnection as New SqlConnection (strConn)

Dim DS1 As DataSet
Dim DS1 As DataSet
Dim MyCommand As SqlDataAdapter

MyCommand = new SqlDataAdapter("exec s_get_table1", MyConnection)
DS1 = new DataSet()
MyCommand.Fill(DS1, "Table1")

MyCommand = new SqlDataAdapter("exec s_get_table2", MyConnection)
DS2 = new DataSet()
MyCommand.Fill(DS2, "Table1")
// Then using MERGE function of dataset we can merge both the datasets like

ds1.merge(ds2)
//binding with grid

MyDataGrid.DataSource=DS1.tables(0).DefaultView
MyDataGrid.DataBind()
End Sub

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Will the asp.net validators run in server side or client side? How do you do client-side validation in .net? How to disable validator control by client side javascript?

513


What is the difference between exe and dll?

551


i develop a web application and i gave security setting i.e autherization and athentication now it work properly on my local system , now question is ,is this security setting ie autherization and athentication which i gave in web.config will it be enough strong to secure my application on internet or i have to use some 3rd party tool or software to get security .if yes --how ? if no--what is the alternate?

1499


Is it possible to change the index of primary key on table?

400


What do you mean by authorization?

516






Explain the function of new view engine in asp.net? : asp.net mvc

506


What is difference between session and application in asp net?

478


How to comment out asp.net tags?

627


What is windows active directory authentication?

563


What is request and response in asp.net?

500


What is a nested masterpage in asp.net 2.0? Can there be a master page inside a masterpage?

498


What I need to create and run an asp.net application?

506


How to find out what version of asp.net I am using on my machine?

573


To add a hyperlink column to the DataGrid which tag is used ?

577


What is a multilingual website?

554