DataTable select record in ASP.Net
My data table have following columns
ID employee age city zip ........
I want to use select to get only those records where age >= 25 and zip = "10001"
So how to use SELECT on datatable for these two criteria?
2 Answers
DataRow[] dataRows = dataTable.Select("age >= 25 AND zip = '10001'");
Note: string values should be in single quote
|
3
|
Answered:
04 Mar 2013
Reputation: 1,109
|
|
We can also use DataView, check this
DataView view = new DataView();
view.Table = dataTable;
view.RowFilter = "age >= 25 AND zip = '10001'";
Now your view will have only those records which matches your criteria.
|
1
|
Answered:
04 Mar 2013
Reputation: 296
|
|
This week users
