更新时间:2023-02-07 18:08:38
你的列表在你的陈述的中间创建知道记录的数量。您可以分两步完成,并获取其间的记录数:
The List that you're creating "in the middle" of your statement "knows" the number of records. You can simply do it in two steps and get the number of records inbetween:
var rows = dataTable.Select(string.Format("[rollNumber]>'{0}'", 10)).ToList<DataRow>();
int numberOfRecords = rows.Count;
rows.ForEach(r =>
{
r["Sem"] = 6;
});
首先为更新后的数据表制作副本说dt1
更新后你会得到另一张表说dt2
现在你可以写下面的代码
dt1.Merge(dt2);
DataTable d3 = dt2.GetChanges();
返回d3.Rows.Count;
First make a copy for that data table before update say dt1
after update you will get another table say dt2
Now you can write below code
dt1.Merge(dt2);
DataTable d3 = dt2.GetChanges();
return d3.Rows.Count;
使用以下命令
System.Data.Linq.ChangeSet changes = db.GetChangeSet();
use below command
System.Data.Linq.ChangeSet changes = db.GetChangeSet();