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);
}*
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);
}*
相关文章推荐
- (当传递具有已删除行的 DataRow 集合时,更新要求有效的 DeleteCommand)解决方法
- 如何解决包冲突,类加载错误的一个方法
- 在VISTA中,使用RUNAS命令运行IE7时报错错误“The RUNAS command is not supported”的解决方法
- jetty java文件无法删除 java文件占用 delete无效 运行时锁定静态资源的解决方法
- 一个服务器搭多个tomcat导致session丢失,或者同一个IP不同端口,多个应用的session会冲突解决方法
- 如何把已经属于一个DataSet的DataTable加到另一个DataSet中解决方法
- ON_COMMAND_RANGE多个按钮响应一个函数的解决方法
- 用SqlDataAdapter.DeleteCommand根据DataSet删除数据库记录的失败教训
- 引用计数的cocos2dx对象内存管理和直接new/delete box2d对象内存管理冲突的解决方法
- error C2857: '#include' statement specified with the /Ycstdafx.h command-line option 解决方法
- detectMultiScale 读取冲突的一个解决方法
- delete语句执行不下去,删除不了数据,解决方法
- mysql delete删除记录数据库空间不减少问题解决方法
- django为了解决同一个项目不同app下Templates冲突的解决方法
- The command ("dfs.browser.action.delete") is undefined 解决Hadoop Eclipse插件报错
- 解决问题:Concurrency violation: the UpdateCommand affected 0 of the expected 1 records(UpdateCommand 影响了预期1 条记录中的0 条 )
- 关于:Update后引发 并发冲突:DeleteCommand 影响 0 个记录 的错误
- 一个服务器搭多个tomcat导致session丢失,或者同一个IP不同端口,多个应用的session会冲突解决方法
- svn 修改文件,删除文件,解决冲突的方法
- TOAD8.3.5 在SQL Editor 中编辑是Backspace键 Delete 键删除失效的问题解决方法