Quote:
Originally posted by CJN
Hi Kris,
I'm pretty new to all this too but have been using datasets alot over the last few weeks. I tried to connect all my database tables through one dataset, dataadapter and all that and found I was having problems with updating and deleting fields/rows from my database (partly because the wizard that sets it all up when you add a dataapater would not createupdate and delete commands and being new to VB/SQL/Databases found it difficult to make my own that worked. The good thing about having everything in one is that its not so messy and easier to work with in terms of remembering which records are going where.
However as I am a idiot and couldn't get everything working as one I went for separate datasets with one connection and separate adapters. This is probably not the most logical way and may visually look a mess but it works for me and it means I can easily work with individual tables without annoying complications. I have had no problems so far doing it this way and the application that I am building is quite a way in. It's easy to use (as long as you remember which table is connected to what) as I can load each table when I need it anddon't have to worry about any of the other tables.
So there you go, my (partly forced) choice is everything separate, with no problems yet! :)
You dont have to use separate DataSets. You only need one DataSet and one DataAdapter for each table. So if you have 3 tables, you would need 3 DataAdapters.
VB Code:
'note, you have to provide a name for the table when you fill it
'if you dont, vb will provide generic names like Table1, Table2 etc.
daOrders.Fill(ds1, "Orders")
daCustomers.Fill(ds1, "Customers")
daProducts.Fill("ds1, "Products")
'bind to a datagrid
dg.DataSource = ds1.Tables("Orders")