Newbie Question: DataView from Two DataTables

  • Thread starter Thread starter Ken Johnson
  • Start date Start date
K

Ken Johnson

I have a DataSet with two DataTables.

Table 1 contains group data: Table 2 contains part data:
CT CT
EG CT05
CT10
EG
EG15
EG20

I need a DataView of Table 2 that contains all the rows not found in Table
1.

DataRelation?

Thanks for any help.
Ken
 
Hi Ken,

You'll have to construct DataView having filter with NOT IN keyword,
something like:
DataView dv = new DataView(tbl, "tubo NOT IN ('CT', 'EG')", string.Empty,
DataViewRowState.CurrentRows);
 
I only gave example data. The actual data in table 1 has over 1000 rows.
Not pratical for a NOT IN type of scenerio. I was hoping that there was
something in DataSet that would allow a third DataTable or a DataView to be
created from the contents of the first two DataTables.

Ken

Miha Markic said:
Hi Ken,

You'll have to construct DataView having filter with NOT IN keyword,
something like:
DataView dv = new DataView(tbl, "tubo NOT IN ('CT', 'EG')", string.Empty,
DataViewRowState.CurrentRows);

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Ken Johnson said:
I have a DataSet with two DataTables.

Table 1 contains group data: Table 2 contains part data:
CT CT
EG CT05
CT10
EG
EG15
EG20

I need a DataView of Table 2 that contains all the rows not found in Table
1.

DataRelation?

Thanks for any help.
Ken
 
Hi Key,

No, there is no such feature afaik.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Ken Johnson said:
I only gave example data. The actual data in table 1 has over 1000 rows.
Not pratical for a NOT IN type of scenerio. I was hoping that there was
something in DataSet that would allow a third DataTable or a DataView to be
created from the contents of the first two DataTables.

Ken

Miha Markic said:
Hi Ken,

You'll have to construct DataView having filter with NOT IN keyword,
something like:
DataView dv = new DataView(tbl, "tubo NOT IN ('CT', 'EG')", string.Empty,
DataViewRowState.CurrentRows);

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Ken Johnson said:
I have a DataSet with two DataTables.

Table 1 contains group data: Table 2 contains part data:
CT CT
EG CT05
CT10
EG
EG15
EG20

I need a DataView of Table 2 that contains all the rows not found in Table
1.

DataRelation?

Thanks for any help.
Ken
 
Back
Top