1
尝试使用simple.data插入并且如果匹配,我想添加到当前值,否则仅使用提供的值。使用simple.data将插入列添加到当前值
如果Id = 13不存在,则失败。
var table = db.TheTable2;
table.UpsertById(Id: 13, Value: table.Value + 10); // Want a row ID=13, Value=10 if not exist, otherwise Value=Value+10.
这工作,因为标识= 13存在
var table = db.TheTable2;
table.UpsertById(Id: 13, Value: 10);
table.UpsertById(Id: 13, Value: table.Value + 10);
怎么办?
什么是你的'UpsertById'的执行情况 – Habib
它对于simple.data添加到标题 –
当记录不存在时table.Value的值是什么?如果它为null,那么这可能是问题,你可以使用table.UpsertById(Id:13,Value:(table.Value ?? 0)+ 10); –