Below will give you the solution about, how to merge two tables
Code:
Code:
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { SqlConnection con; SqlDataAdapter da; DataSet ds1 = new DataSet(); DataSet ds2 = new DataSet(); protected void Page_Load(object sender, EventArgs e) { binddata(); } public void binddata() { con=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(); } }