Here we have a DataTable "dt" with the various fileds with Duplicate data.
For Example we have records for population Country wise in the dt.
If, we have to show data acc. to "INDIA"
DataTable dt_filtered = dt.AsEnumerable() .Where(a => Convert.ToString(a["Country"]) = = "INDIA") .CopyToDataTable();
Here "Country" is the field in the datatable by with we are filtering
"dt_filtered" contains data INDIA wise.
--------------------
If, we have to show data acc. to "US", Then
DataTable dt_filtered = dt.AsEnumerable() .Where(a => Convert.ToString(a["Country"]) = = "US") .CopyToDataTable();
"dt_filtered" contains data US wise.
No comments:
Post a Comment