How to handle CopyToDataTable() when no rows?

后端 未结 6 1915
滥情空心
滥情空心 2020-12-15 03:21

I have the code:

dt = collListItems.GetDataTable().AsEnumerable()
        .Where(a => Convert.ToString(a[\"Expertise\"]).Contains(expertise) && Co         


        
6条回答
  •  Happy的楠姐
    2020-12-15 03:56

    Below code works for me. please try

     DataRow []dataRow = dataTable.Select(query, seq);
     if (dataRow != null && dataRow.Length > 0)
     {
         return dataTable.Select(query, seq).CopyToDataTable();                                            
     }  
    

提交回复
热议问题