Display rows from one table not in another in a dataset

S

Sam

I have a dataset with 2 tables. I want to display in a datagrid the
rows in table 1, that are not in table 2. I'm trying the rowfilter on
a dataview, but I'm getting an error. The error I'm getting is:
Syntax error: Missing operand after 'ID' operator.

Here is what I'm doing...
dvInWindows = Me.g_dsCodes.Tables("Table1").DefaultView
dvInWindows.RowFilter = "ID1 not in (select ID2 from Table2)"

What is the correct syntax for this?

Thanks...
 
C

Cor Ligthert[MVP]

Sam,

So extended is AFAIK the Select in the dataview not going.

An option the relation is something you cannot use because that expects that
there is always parent child relation.

If it was my problem, then I would create an extra datatable using an SQL
statement with a join in it, that is probably for most the easiest.

Without that you can create an extra table with looping through your table
or by creating an extra column in your dt and fill that while looping with
the id of table 2 and then use that as filter.

Cor
 

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