Author: urpalshu | Posted on: 3/29/2010 4:26:43 PM | Views : 1016

Hello :
I have two DataTables, with Different Columns. Some of the Columns are same between them.
i am looking to do this.
It is also refered to as MINUS and is simply all the rows that are in the First table but not the Second.
These three colums are same between the two tables.
string[] strCols = { "CustomerID", "CustomerName", "CustomerCity" };
I tried this but it seems to return all the Rows from the Table1.
Kindly help with syntax
Thanks,

 
  protected void Page_Load(object sender, EventArgs e)
 {
     DataTable dataTable3 = Difference(Table1.DefaultView.ToTable("FirstTable", true, strColsToExport), Table2.DefaultView.ToTable("SecondTable", true, strColsToExport)).Copy();
 }
 
 public static DataTable Difference(DataTable First, DataTable Second)
     {
 
         //Create Empty Table
 
         DataTable table = new DataTable( ...

Go to the complete details ...