Using Multiple Tables in a Single Dataset

So far, the datasets we've used only held a single table of data, but a dataset can contain several tables at once. To see how this works, take a look at the Ch09_03 example in the code for this book. This example uses two SqlDataAdapter controls, sqlDataAdapter1, connected to the authors table in the pubs database, and sqlDataAdapter2, connected to the titleauthor table in the pubs database (in this example, we'll select all fields of both these tables). When you create a dataset using these data adapters, you can add data from both adapters into a single dataset.

To see how this works, create these data adapter objects now and select Data, Generate Dataset. You can add both data tables to a single dataset ...

Get Microsoft® Visual C#® .NET 2003 Kick Start now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.