
July 12th, 2003, 06:38 AM
|
|
Junior Member
|
|
Join Date: Jul 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Filtering two datatables using ado.net
I have two datatables which are populating from two different tables of two different databases. I want to get all the records of first datatable which are not in 2nd datatable. I ‘m using the following piece of code.
odr = oDs.Tables(0).Select("Sno = (SELECT SNO FROM " + Convert.ToString(oDataSetChanges.Tables(0)) + ")")
or this one
odr = oDs.Tables(0).Select("Sno NOT IN (SELECT " + Convert.ToString(oDataSetChanges.Tables(0).Columns ("SNO")) + " FROM " + Convert.ToString(oDataSetChanges.Tables(0)) + ")")
or I tried the following code as well
oDv1.RowFilter = "Sno NOT IN (SELECT SNO FROM " + Convert.ToString(oDv2.Table) + ")"
where SNO are the primary key columns of both tables but by using all these code I got the same syntax error that is
Message "Syntax error: Missing operand after 'SNO' operator."
Kindly help me in this reagard ASAP
Thanx in advance
|