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

What is the difference between runtime version and version?

509


What is the request flow used for asp.net mvc framework? : asp.net mvc

533


Define static constructor?

560


What are session objects?

513


Explain the reason why the javascript validation not run on the asp.net button but run successfully on the html button?

578






What are client activated objects?

559


Mention the namespace that is used to include .net data provider for sql server in .net code?

509


What asp.net control can embed xaml into asp.net pages?

543


What are the 3 types of web?

508


What is the exact purpose of http handlers?

568


Which of the following .NET framework supports Web API?

643


How will you do Redo and Undo in a TextControl?

672


Describe briefly what is the role of IIS on an ASP.NET application? What does it for the same application?

565


Can anyone please tell me that the question posted on this website are Sufficient for the interview with 2+ year experience in .net

1507


Explain login control and form authentication.

565