0

I have a code like this.

DBContext is Datacontext instance.

try
            {
                TBLORGANISM org = new TBLORGANISM();
                org.OrganismDesc = p.Subject;
                DBContext.TBLORGANISMs.InsertOnSubmit(org);
                DBContext.SubmitChanges();
            }
            catch (Exception)
            {
            }

At this point, I want to IGNORE the error and want to be skipped. Not to be retried. But when I try another insert like

                TBLACTION act = new TBLACTION();
                act.ActionDesc = p.ActionName;
                DBContext.TBLACTIONs.InsertOnSubmit(act);
                DBContext.SubmitChanges();

SubmitChanges firstly retries previous attempt.

How can I tell "skip errors, don't try again"?

Ahmet Altun
  • 175
  • 1
  • 11

2 Answers2

1

Create a new instance of DBContext the second time.

But why do you want to skip errors?

Raj Kaimal
  • 8,304
  • 27
  • 18
1

Try this: DBContext.SubmitChanges(ConflictMode.ContinueOnConflict). Hope it will help.

Alex Navasardyan
  • 536
  • 5
  • 12