您的位置:首页 > Web前端

Concurrency violation: the DeleteCommand affected 0,一个解决dataset并发删除冲突的方法

2009-02-02 17:16 337 查看
Set ContinueUpdateOnError = true, then do some action with the errors.

dtaMailingList.ContinueUpdateOnError = true;

int iAffectedRows = dtaMailingList.Update(dsMailingListInfo,"MailingList");

if (dsMailingListInfo.MailingList.HasErrors)

{

DataRow[] drs = dsMailingListInfo.MailingList.GetErrors();

foreach (DataRow dr in drs)

if (dr.RowError.IndexOf("Concurrency violation") > -1)

dsMailingListInfo.MailingList.RemoveMailingListRow((MailingListInfo.MailingListRow)dr);

dsMailingListInfo.MailingList.AcceptChanges();

// If the dataset still has errors, then an exception needs to be thrown

if (dsMailingListInfo.MailingList.HasErrors)

throw new DataException("An exception was raised while updating the mail list: " +

dsMailingListInfo.MailingList.GetErrors()[0].RowError);

}*
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐