Collections to Database

From: Jac (Jac_at_discussions.microsoft.com)
Date: 06/22/04


Date: Tue, 22 Jun 2004 13:23:01 -0700

Hey,
Newbie in using ADO.NET.

What I do now : I read the database with an OleDbDataReader. For each row I read I make an object (let say Person + that object contains a collection with the addresses etc.). All the objects I put in a collection called ‘Persons’.
Then I work on that collection (delete, update, add). Each object in the collection contains a state (Add, Update or deleted state).

At the end I want to go back to the database.
What is a best practice to do this?
- Do I pump my collection ‘Persons’ in a dataset, and for each row I set the datarowstate (= state of each object in my collection). I don’t know if this is possible. And then I do dataset.Update and Dataset.Acceptchanges?? Is that not too much (collection to dataset, dataset to database)??
- I cannot use the SQLCommandBuilder because I need joins. What do I have to use if I will update the database???

Thanks in advance.



Relevant Pages

  • Collection directly to database
    ... Newbie in using ADO.NET. ... Each object in the collection contains a state (Add, Update or deleted state). ... At the end I want to go back to the database. ... What is a best practice to do this? ...
    (microsoft.public.dotnet.languages.csharp)
  • collections directly to database
    ... Newbie in using ADO.NET. ... Each object in the collection contains a state (Add, Update or deleted state). ... At the end I want to go back to the database. ... What is a best practice to do this? ...
    (microsoft.public.dotnet.languages.csharp)