我对 C# LINQ 查询有点困惑。我有一个表格,其值如下所示
DataTable tableold = new DataTable();
tableold.Columns.Add("Dosage", typeof(int));
tableold.Columns.Add("Drug", typeof(string));
tableold.Columns.Add("Patient", typeof(string));
tableold.Columns.Add("Date", typeof(DateTime));
// Here we add five DataRows.
tableold.Rows.Add(25, "Indocin", "David", DateTime.Now);
tableold.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
tableold.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
tableold.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
tableold.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);
现在我还有另一张桌子
DataTable tableNew = new DataTable();
tableNew.Columns.Add("Dosage", typeof(int));
// Here we add five DataRows.
tableNew.Rows.Add(25);
tableNew.Rows.Add(50);
tableNew.Rows.Add(10);
我需要将 tableold (基表)中的值保留在 tableNew (新表)中不存在的值。
所以我需要更新的数据表(tableold)如下所示:
21, "Combivent", "Janet", "10:20:00"
100, "Dilantin", "Melanie", "10:20:00"
如何在 C# 或 LinQ 中编写此类查询
请帮忙!谢谢