I have a little problem. I don’t know how to use the DataSet in VB.NET correctly.
In Visual Studio 2008 I created a DataSet called Network. For the DataSet I took two tables from my database, tServer and tClient. tClient has a foreign key referencing the ID in tServer.
After creating the DataSet I found a new namespace called NetworkTableAdapter which contains the adapter for tServer, tClient and an AdapterManager. There is also a new class called Network, which is the DataSet and contains the DataTables for tServer and tClient.
But how can I fill these DataSet with data and access it? The adapter only have GetData() and Fill() methods, which fill a DataTable, but I want to fill the DataSet.
Sorry for my bad english, I hope that someone understand my problem and can help me. 🙂
Torben
As far as im aware you cant automagically fill a full dataset it this way. Youd have to populate each table in it. To do so, if your using the visual dataset, just right click on the table adapter, and add query. From here you can either add SQL straight into the table adapter, or use a stored procedure.
For the example of a select, the select must match the columns in your dataset.
So if we have a DataTable called CustomersTable, and we have added a func called “GetNewCustomers() you could do CustomersTable dtCustomers = adapter.GetNewCustomers()
See a much better description and tutorials start with #1 and #2 here
Datasets are .NET 2.0 however. I would recommend maybe getting to grips with them and then looking at LINQ2Entities to map your database.
Hope this helps.