Reputation: 4068
I can't seem to figure out how to just return all rows when using Select on a DataTable.
My code so far:
foreach (DataRow r in data.Select("Sort != null", "Sort"))
{ //process }
I get the following error:
Cannot interpret token '!'
The Sort column is of type Guid and is used to return the rows in a random order.
Upvotes: 2
Views: 5253
Reputation: 9
How about
foreach (DataRow r in data.Select())
{ //process }
See https://learn.microsoft.com/en-us/dotnet/api/system.data.datatable.select?view=netframework-4.8
Upvotes: 1
Reputation: 822
You could also try:
foreach (DataRow r in data.Select("Sort <> null", "Sort"))
{ //process }
Upvotes: 1
Reputation: 488
Try this instead...
foreach (DataRow r in data.Select("Sort IS NOT NULL", "Sort"))
{ //process }
Upvotes: 4