OK this is a solution of your current problem.
However, if you have such a table structure in your database with two tables this similar, you should reconsider your database design as it is a complete waste of space with two so similar tables.
My sample data
DataTable dt1 = new DataTable();
dt1.Columns.Add("slno", typeof(int));
dt1.Columns.Add("name", typeof(string));
dt1.Columns.Add("year", typeof(double));
dt1.Columns.Add("amount", typeof(int));
dt1.Columns.Add("bank", typeof(string));
dt1.Columns.Add("address", typeof(string));
dt1.Columns.Add("company", typeof(string));
dt1.Rows.Add(1, "John", 2014, 2000, "ING", "oruf", "Google");
dt1.Rows.Add(2, "Mik", 2014, 5000, "ING", "tiejd", "Micro");
dt1.Rows.Add(3, "Robin", 2014, 1000, "INF", "trydh", "Jen");
DataTable dt2 = new DataTable();
dt2.Columns.Add("slno", typeof(int));
dt2.Columns.Add("name", typeof(string));
dt2.Columns.Add("year", typeof(int));
dt2.Columns.Add("amount", typeof(int));
dt2.Columns.Add("bank", typeof(string));
dt2.Columns.Add("address", typeof(string));
dt2.Rows.Add(1, "John", 2014, 2000, "ING", "oruf");
dt2.Rows.Add(2, "Mik", 2014, 5000, "ING", "tiejd");
dt2.Rows.Add(3, "melon", 2013, 21551, "SBI", "hhdh");
Assuming you have two tables called dt1 and dt2, you create a third table that has the same number of columns as dt1.
DataTable dt3 = new DataTable();
dt3.Columns.Add("slno", typeof(int));
dt3.Columns.Add("name", typeof(string));
dt3.Columns.Add("year", typeof(int));
dt3.Columns.Add("amount", typeof(int));
dt3.Columns.Add("bank", typeof(string));
dt3.Columns.Add("address", typeof(string));
dt3.Columns.Add("company", typeof(string));
int noRows = (dt1.Rows.Count < dt2.Rows.Count) ? dt1.Rows.Count : dt2.Rows.Count;
int noCols = (dt1.Columns.Count < dt2.Columns.Count) ? dt1.Columns.Count : dt2.Columns.Count;
for (int i = 0; i < noRows; i++)
{
DataRow dr1 = dt1.Rows[i];
DataRow dr2 = dt2.Rows[i];
bool equal = true;
for (int j = 0; j < noCols; j++)
{
if (!dr1[j].Equals(dr2[j]))
{
equal = false;
break;
}
}
if (equal)
{
dt3.LoadDataRow(dr1.ItemArray, true);
}
}
You should probably read up on this topic. Even if it is not your design.
Database normalization[
^]
3 Normal Forms Database Tutorial[
^]
Database Normalization Basics[
^]