Re: Collections to Database
From: Val Mazur (group51a_at_hotmail.com)
Date: 06/24/04
- Next message: Val Mazur: "Re: VBscript Error 800a01a8 on Connection.Close"
- Previous message: Val Mazur: "Re: active data objects library 2.7's use with Windows 2000 sp3"
- In reply to: Jac: "Collections to Database"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 23 Jun 2004 22:03:06 -0400
Hi,
Any reason to load data into collection? It looks like you are trying to do
the job which already done and optimized in ADO.NET. I would suggest to lad
data into the DataSet, rather than into collection and set the relations
between the DataTables inside of the DataSet. In this case you will avoid
additional steps to load data from the collection and code would look much
simpler. After changes completed in a dataset, you could use DataAdapter to
update actual database
-- Val Mazur Microsoft MVP "Jac" <Jac@discussions.microsoft.com> wrote in message news:8482E086-B7B1-4977-874D-70CFCE9A8A0E@microsoft.com... > 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. >
- Next message: Val Mazur: "Re: VBscript Error 800a01a8 on Connection.Close"
- Previous message: Val Mazur: "Re: active data objects library 2.7's use with Windows 2000 sp3"
- In reply to: Jac: "Collections to Database"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|