c# data table query not exist joins

前端 未结 1 668
攒了一身酷
攒了一身酷 2021-01-29 13:35

I am bit confused with C# LINQ queries. I have a table with values as shown below

DataTable tableold = new DataTable();
tableold.Columns.Add(\"Dosage\", typeof(i         


        
1条回答
  •  渐次进展
    2021-01-29 13:54

    Try this:

     var compare= tableold.AsEnumerable().Select(r => r.Field("Dosage"))
             .Except(tableNew.AsEnumerable().Select(r => r.Field("Dosage")));
     DataTable tblResult= (from row in tableold.AsEnumerable()
                                    join id in compare
                                    on row.Field("Dosage") equals id
                                    select row).CopyToDataTable();
    

    0 讨论(0)
提交回复
热议问题