RE: How to insert into multiple tables with one update.



You can check out this article I wrote in MSDN Mag that show show to take 3
levels of 1 to many tables and insert them using ADO.NET ...

http://msdn.microsoft.com/msdnmag/issues/04/05/DataPoints/

// John Papa
// http://codebetter.com/blogs/john.papa


"Geir Holme" wrote:

> Hi all.
> When I first heard about VB.NET it should be so easy to update
> "Mother/child" tables. Just build at datasett with all the tables, do the
> changes and run .Update.
>
> Well, I cant get this to work that easy. Do anyone have some pointers on how
> to do this.
>
> Pseudo example.
>
> I want to insert a new Customer. The customer is connected to a Statistics,
> Postalcode, FreightDeal, Contacts, ExtendedCustomerInfo..+++++
>
> I just want to load a "blank" form and insert the values an push OK. Then
> ..NET inserts all the values where it belongs. When working with the customer
> an button opens e.g a contactform for new contacts and so on. All without
> saving anything to the database yet. All tables have identity and one to
> many relations. One customer can have many freghtDeals and so on.
>
> In VB6 we had to first save the customer, get the identity an save tables.
> So, if we wanted to add FreightDeals when we inserted the customer we first
> had to save the customer and then insert one and one FreightDeal. And
> offcause the user canceled it all at the end and we had to delete all the
> records.
>
> I am sure this is elementary, but can't seem to get the hold of it. Any
> pointers to help on this are welcome.
>
> Thanks all.
>
> -gh
>
>
>
.


Loading