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

Can I read the hard disk serial # of the client computer using asp.net?

733


What are the different types of cookies in asp.net?

736


Which is the parent class of the web server control?

763


Is asp.net easy to learn?

712


Define caching.

820


What is the use of placeholder control?

737


Give a few examples of page life cycle events.

862


Any disadvantages in Dataset and in reflection ?

2993


What is the difference between ASP.NET Webforms and ASP.NET MVC?

786


What’s the catch?

823


What is autopostback true?

785


State differences between MVC and WebAPI

802


Describe the difference between inline and code behind - which is best in?

721


Explain swagger components.

743


Explain what benefit does your code receive if you decorate it with attributes demanding specific security permissions?

727