Datatable filtering

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it Possible to execcute queries against a datatable?
If so what syntax do i use to run against it
i.e say i have a datatable with the following columns

RenterI
RenterNam
RenterAdd
RenterPostC
RentCos

Say if i wanted to filter on RentCost and Postcode. How would i do this
e.g post code W1 and Rentcost < 200
 
Sure, see DataTable.Select method or DataView (RowFilter property) and
DataColumn.Expressions .net help topic.
In your case you would do something like:

DataView dv = new DataView(yourtable);
dv.RowFilter = "RenterPostCd = 'W1' AND RentCost<200";
 

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

Back
Top