I have a dataset with one datatable. Now I want to set a filter on this table and copy the result to a dataset of the same type, so that I have a new dataset with only the result of the filtering. How can I do this?
Does the following code work?
ds.Tables[<table name>].DefaultView.RowFilter = "ProductId=5";
newDS = ds.copy();
You could do the following:
Please note that DataTable offers Select method, but it throws some very weird exceptions from time to time, hence I prefer working with enumerable list of rows and lambdas instead.