I would like to compare columns of 2 data table.
my 1st data table:
| app_ID | int | True | AppID | Both | |
| app_Name | varchar | True | AppName | Both | |
| app_Adress | varchar | True | AppAddress | Both | |
| app_Lattitude | varbinary | True | AppLatitude | Both | |
| app_Longitude | varbinary | True | AppLongitude | Both | |
| app_Gender | char | false | |||
| app_IsApplicationCorrect | bit | false |
and my 2nd table:
| app_ID | int | |
| app_Salutation | varchar | |
| app_Name | varchar | |
| app_Adress | varchar | |
| app_Lattitude | varbinary | |
| app_Longitude | varbinary | |
| app_Gender | char | |
| app_IsApplicationCorrect | bit | |
| app_IsWorkingProper | bit |
i want to compare 1st and 2nd tables 1st column and check for new data if available and add the data from 1st table to 2nd table...
OUT PUT should be:
| app_ID | int | True | AppID | Both |
| app_Salutation | varchar | false | ||
| app_Name | varchar | True | AppName | Both |
| app_Adress | varchar | True | AppAddress | Both |
| app_Lattitude | varbinary | True | AppLatitude | Both |
| app_Longitude | varbinary | True | AppLongitude | Both |
| app_Gender | char | false | ||
| app_IsApplicationCorrect | bit | false | ||
| app_IsWorkingProper | bit | false |
Mohammad ImranPosted Sep 10, 2014, 3:05 AM
Vasanth KrishnanPosted Sep 2, 2014, 3:14 AM
StringCollection lsttable1ColumnValues = new StringCollection();
StringCollection lsttable2ColumnValues = new StringCollection();
Add that particular column values to the list
//Add the table 1 value in the list
foreach (DataRow drTable1 in dtTable1.Rows)
{
lsttable1ColumnValues.Add(drTable1["Column1"].ToString());
}
foreach (DataRow drTable1 in dtTable1.Rows)
{
lsttable2ColumnValues.Add(drTable1["Column1"].ToString());
}
Now u can compare the list that are common in the two list and achieve what u want.
Thanks
Raghavendra JoshiPosted Sep 2, 2014, 2:55 AM
Vasanth KrishnanPosted Sep 2, 2014, 2:21 AM