如何 select DataTable 中的所有行
how to select all rows from a DataTable
我似乎无法弄清楚如何在 DataTable 上使用 Select 时仅 return 所有行。
到目前为止我的代码:
foreach (DataRow r in data.Select("Sort != null", "Sort"))
{ //process }
我收到以下错误:
Cannot interpret token '!'
Sort列的类型为Guid,用于return 行随机排列。
试试这个...
foreach (DataRow r in data.Select("Sort IS NOT NULL", "Sort"))
{ //process }
您也可以试试:
foreach (DataRow r in data.Select("Sort <> null", "Sort"))
{ //process }
怎么样
foreach (DataRow r in data.Select())
{ //process }
见https://docs.microsoft.com/en-us/dotnet/api/system.data.datatable.select?view=netframework-4.8
我似乎无法弄清楚如何在 DataTable 上使用 Select 时仅 return 所有行。
到目前为止我的代码:
foreach (DataRow r in data.Select("Sort != null", "Sort"))
{ //process }
我收到以下错误:
Cannot interpret token '!'
Sort列的类型为Guid,用于return 行随机排列。
试试这个...
foreach (DataRow r in data.Select("Sort IS NOT NULL", "Sort"))
{ //process }
您也可以试试:
foreach (DataRow r in data.Select("Sort <> null", "Sort"))
{ //process }
怎么样
foreach (DataRow r in data.Select())
{ //process }
见https://docs.microsoft.com/en-us/dotnet/api/system.data.datatable.select?view=netframework-4.8