Select rows from DataSet with 2 tables

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

I have a DataSet with two tables in it. They have the same column
names and I would like to get everything from the second table where
one of its columns equals the identical column in the first table.

For example:

oDS.Tables["First"].Columns["vpath"]
oDS.Tables["Second"].Columns["vpath"]

I would like to pull every record from the second table where its
vpath exists in a record from the first table.

Is this possible?

Any help would be appreciated.

Thanks,

Tim
 
Hi,
AFAIK there is no one line statement to do this but you can use the
'Select' method and specify the criteria and collect all the second table
rows for which
there is a row in the first table with same value.perform this in a loop.

for (rows in second table)
searchval=row["vpath"]
if( firsttable.Select("vpath='{searchVal'})!=null)
resultable.ImportRow(row);

The resultable will have all the records of the second table which have a
identical column in the first table.

HTH.
 
Back
Top