views:

33

answers:

1

Table 1: int ID-a(pk)

Table 2: int ID-a(pk), int ID-b(pk)

Table 3: int ID-b(pk), string C

I have the data to insert into Table 1. But I do not have the ID-a, which is autogenerated. I have many string C to insert in Table 3.

I am trying to insert row into Table 1, get the ID-a to insert in Table 2 along with the ID-b that is auto-Generated in Table 3 when I submit each string C, all in one submission to db.

Right now I am calling dc.SubmitChanges twice in same call. Is it efficient to have to submit changes twice on same DataContext or can this be combined further?

A: 

Can you just write a stored procedure to put the information into the correct tables, and just have linq access the stored procedure.

That would probably be the simplest method, IMO.

James Black