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);
    }*

相关文章:

  • 2021-10-30
  • 2021-12-30
  • 2021-12-27
  • 2022-01-12
  • 2021-04-20
  • 2021-10-06
  • 2021-05-28
猜你喜欢
  • 2022-01-18
  • 2022-12-23
  • 2021-07-10
  • 2022-01-11
  • 2021-05-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案