-
Ado.Net and Access DB's
Ok I'm quite fluent with VB6's ADO but now I have to learn Ado.net and I have some question if anyone can help.
I see they added a new layer between the data/db, a Adapter, I'm assuming other than being a data pipe between the dataset and db, it's not really used directly?
Also I'm confused now, I am used to recordsets where if I need a record, I simply query it from the database and store the data in a recordset so I can work with it. The dataset seems to have the same function but instead you can query multiple records, or a whole table and store it into memory? Now when you change a value in the dataset, does it automatically change in the DB? :confused: Can you use a Dataset like a normal memory space and access/write to it as you can a variable or what?
What about multiple Tables, I have dozens of tables, do I need to load each table in a seperate dataset or can I just load the whole database into the dataset and access the dataset as I would normally the database in old ado?
any insightfull feedback would be greatfull..
-
Hinder:
By my understading, the point of the dataset is to give the programer a better "offline" ability, which saves resources on the server, network ect...
When you make changes to a dataset (ie update, delete, insert) they are not automatically updated in the DB until you call the update statement.
DataAdapterName.Update(DatasetName)
Of course there should be other code in front and after to check for changes in the dataset before applying changes, errors, ect...
As for multiple tables, it's really up to you on how you designed the DB back end. The big advantage I found with the dataset with multiple tables is the easy config of relations ect... The biggest thing you must remember when putting a whole load of tables in one dataset is that each time you call the adapters fill method on that dataset, it is possible to drag a fair load across the wire if your tables are large.
The first time I looked at ado.net I was really disappointed with a few of the changes that were drawbacks, like concurrency issues. But once I found out how to deal with them, the new platform has some new wild features that are really handy . I find it really gives you great control over most anything you want.