about 7 years ago
I am working on a Asp.Net application where I got stuck in a issue in which I have to merge two column values of different DataTable into another DataTable....
If anyone has any idea please help...! Thanks in advance
As per my understanding you want to merge two column values from two different DataTables into a single DataTable.
In a simplest manner you can iterate through each row of the two DataTables to be merged and then save merged values into a result DataTables
Please have a look at the sample code below, in case you have any problem, please let me know.
//Inserting value in the first DataTable dt1
DataTable dt1 = new DataTable();
DataRow dr = dt1.NewRow();
dr["FirstName"] = "FirstName_1";
dr = dt1.NewRow();
dr["FirstName"] = "FirstName_2";
//Inserting value in the second DataTable dt2
DataTable dt2 = new DataTable();
DataRow dr1 = dt2.NewRow();
dr1["LastName"] = "LastName_1";
dr1 = dt2.NewRow();
dr1["LastName"] = "LastName_2";
//Merging the values of two columns into another DataTable dt3
DataTable dt3 = new DataTable();
for (int i = 0; i < dt1.Rows.Count; i++)
dr3 = dt3.NewRow();
dr3["Name"] = dt1.Rows[i]["FirstName"].ToString() + " " + dt2.Rows[i]
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2022 FindNerd.com. All rights reserved.
Sign up using