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";
 
Back
Top