Can you give an example?
A:
Well I can't see any reason for "wanting" to do that... Remember, a DataView is just a list of pointers to the rows in the original table, and there is obviously no way to remove columns from the the original table... at least not without affecting every other function utilizing that table... Just only use the columns you want...
Charles Bretana
2009-07-29 15:58:05
A:
DataSet
and its associated types have no ability to perform relational operations.
John Saunders
2009-07-29 16:10:12
+1
A:
You can't do that, but you can create a copy of the table with only the columns you want :
DataView view = new DataView(table);
DataTable table2 = view.ToTable("FirstColumn", "SecondColumn", "ThirdColumn");
Optionally you can return rows that have distinct values for the selected columns :
DataView view = new DataView(table);
DataTable table2 = view.ToTable(true, "FirstColumn", "SecondColumn", "ThirdColumn");
Thomas Levesque
2009-07-29 16:15:09
Thank you, Thomas. I'd also like to be able to include calculated columns in "table2". For example, view.ToTable ( "FirstColumn * 2", "SecondColumn > 0", "TRIM(ThirdColumn)" ) .
JaysonFix
2009-07-29 16:26:42
create them in table and select them in ToTable, or add them to table2 after you created it...
Thomas Levesque
2009-07-29 17:00:55