tags:

views:

647

answers:

2

I am using ADO.NET Datasets in my VB Applocations. I have a typed dataset with one Parent table and many child tables. I want to generate Identity Key when I insert data into Parent Table and then update the data in all child tables with the Same key (As Foregin key).

At last, I want to update the dataset in Database(SQL Server08).

Well, the above thing can be possible by first inserting Parent Table in Database directly, get the Identity column and than use to for Child tables.

But I want to this as an automatic operation (Like LINQ to SQL which takes care of Primary & Foreign key in datacontext.)

I such thing possible in Dataset which takes care of Autogenerated column for Parent and child tables?

Thanks,

ABB

+3  A: 

Look at this

RJ1516
A: 

And if you don't want to use datasets and yet get the ids assigned to childs and getting the ids so that you can update your model: http://daniel.wertheim.se/2010/10/24/c-batch-identity-inserts/

//Daniel

Daniel