Select rows from DataSet with 2 tables

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
 
S

Sudha

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top