![]() ![]() | ||
A single dataset can contain multiple tables. You can see how this works in the MultiTable example on the CD-ROM. In this case, I've added two SqlDataAdapter controls to the main form, and connected one to the authors table in the SQL Server pubs database, and the second to the publishers table in the same database. Now when I create a dataset (using the Data|Generate Dataset item menu item), I add both those tables to the dataset, as you see in the Generate Dataset dialog in Figure 20.29.
That's all it takes; that's the way to add both tables to the same dataset. Now I can bind two data grids to the same dataset, displaying a different table in each data grid. (After setting the data grids' DataSource property to the new dataset, I've set the DataMember property of the first data grid to authors and the DataMember property of the second data grid to publishers.) You can see the result in Figure 20.30.
Related solution: |
Found on page: |
---|---|
960 |
![]() ![]() | ||