how to join two datatable datas into one datatable to show in one gridview
i.e in 1 datatable i have username and pwd and in another datatable i have that user details. how to show all these in one datatable to get those values display in gridview(asp.net)
any idea????
on=new SqlConnection("Data Source=MCN101; Initial Catalog=MergeTable; Uid=sa; pwd=");
da = new SqlDataAdapter("Select * from Table1", con);
da.Fill(ds1, "Record");
da = new SqlDataAdapter("select * from Table2", con);
da.Fill(ds2, "Record");
ds1.Merge(ds2);
GridAllRecord.DataSource = ds1;
GridAllRecord.DataBind();
You can merge two datatable, here is the sample for that. http://msdn.microsoft.com/en-us/library/system.data.datatable.merge.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With