views:

208

answers:

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?

+2  A: 

Yes, SubmitChanges will then call 3 inserts.

JustLoren
A: 

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?

Martin
It's my understanding that if any of those fail under db.SubmitChanges() the whole insert fails, not just one.
Liam
Thank you, that was all I wanted to know :D
Martin