Running Select query against dataTable

  • Thread starter Thread starter VMI
  • Start date Start date
V

VMI

How can I run a Select query from a datatable so that it only brings the
fields I want? For example, if my datatable has 30 fields, a query would be
"select custId, Name" because those are the only two fields I need. Then I'd
like to put the result in another datatable.

Thanks.
 
VMI,

You can't perform selects in that manner from a DataTable. The best you
can do is call the Select method, and pass a filter based on column values
(the documentation for the Select method will tell you how you can construct
a filter). Once you do that, you can take the rows returned, and copy only
the columns you want from each row to a new data table.

Hope this helps.
 
Back
Top