How to handle CopyToDataTable() when no rows?

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

I have the code:

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


        
6条回答
  •  有刺的猬
    2020-12-15 04:04

    var results = from myRow in dtL1Users.AsEnumerable()
                                              where (Convert.ToInt32(myRow["No_x0020_of_x0020_L1_x0020_Remin"]) >= Convert.ToInt32(maxL1Escalation) && Convert.ToDateTime(myRow["L2_x0020_Last_x0020_Escalated_x0"]) < DateTime.Now.Date.AddDays(-Convert.ToInt32(reminderinterval)))
                                              select myRow;
    
                                foreach (var v in results)
                                {
                                    collEligible = results.CopyToDataTable();
                                    break;
                                }
    

提交回复
热议问题