Merge 2 tables in C#

http://www.dotnetheaven.com/UploadFile/rahul4_saxena/MergetheData06012007012539AM/MergetheData.aspx

SqlConnection con;
SqlDataAdapter da;
DataSet ds1 = new DataSet();
DataSet ds2 = new DataSet();
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);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s