2

Just a quick one really, I'm just looking for a bit of clarification.

I'm looking to update multiple tables from one "Create" action, before I try it, I was just wondering if it's possible to simply just do the following:

db.hdCalls.InsertOnSubmit(a)
db.hdCustomers.InsertOnSubmit(b)
db.hdAssign.InsertOnSubmit(c)
db.SubmitChanges()

Or is it slightly more complicated than that?

0

2 Answers 2

4

Yes, SubmitChanges will then call 3 inserts.

Sign up to request clarification or add additional context in comments.

Comments

1

A small question even if this post is old.

What if one of the inserts fails, will all the other inserts rollback? Because if one fail, I sure does not want any of the other inserts to commit.

How is this handled?

1 Comment

It's my understanding that if any of those fail under db.SubmitChanges() the whole insert fails, not just one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.