There will be a requirement where you have to filter out the data you fetched from the database into a DataTable. In this scenario we can user a DataView to filter out the data.
Ex: I have states of India and their zone
DataTable dtStates(ID, Name, Zone) : 1 Andhra Pradesh South, 2 Arunachal Pradesh East, 3 Bihar North
I need to filter out the ones that are in south zone. Here is the code for it
DataView dvSouthZoneStates = dtStates.DefaultView;
dvSouthZoneStates.RowFilter = "Zone='South'";
Now we can use this DataView to bind data.
Showing posts with label Filter DataTable. Show all posts
Showing posts with label Filter DataTable. Show all posts
Thursday, August 6, 2009
Subscribe to:
Posts (Atom)
