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 you explain one critical mapping? Performance issue which one is better?

469


What is use of Master Page in ASP.NET web pages?

627


What is cross page posting in asp net?

534


Which is better session or viewstate?

512


What are the uses of reflection?

579






How can you debug your.net application?

554


Is it possible for me to change my aspx file extension to some other name?

586


Can you clarified A Web service can only be written in .NET or not?

539


Explain how to prepare culture-specific formatting in .net.

536


What is the difference between mechine.config and web.config?

734


Differentiate between Server.Transfer and Response.Redirect with functionality? Why we can choose one over the other?

616


What is the use of view state?

534


What is xaml? Are xaml file compiled or built on runtime?

527


What are client activated objects?

557


What does asp.net stand for?

540