|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Generate Dataset Dialog Box
Allows you to display options for generating a typed dataset class from information provided by one or more data adapters. Use this dialog box to:
- Create a new typed class.
- Add tables to an existing dataset class or change the column definitions of a table already in the dataset.
Note To remove a table from a dataset class, edit the dataset's schema using the XML Designer. For more information, see Creating New Typed Datasets with the XML Designer.
The typed dataset class generated as a result of this dialog box is stored in your project as two files: an XML Schema (.xsd) file and a corresponding class (.vb or .cs) file that incorporates the schema information. For more information about generating typed dataset classes, see Creating Typed Datasets with the Component Designer.
You display the Generate Dataset dialog box by performing either of these actions:
- Choose the Generate Dataset command from the Data menu.
- Select one or more dataset adapters in the form or component and click the Generate Dataset link at the bottom of the Properties window.
- Choose a Dataset
- Select whether you want to generate a new dataset class or regenerate an existing one. Choose one of these options:
- Existing This option specifies that you want to add or re-add a table to an existing dataset class. Select the dataset to update from the list.
- New The option allows you to specify a name for a new dataset class.
- Choose which tables to add to the dataset
- Specifies the table or tables to add to the dataset. The list of tables is derived from the data adapters in the form or component. (Each data adapter typically accesses a single table.) The names of the tables to generate are derived from the adapter's TableMappings property; if no table mappings are specified, the table name is passed through from the data source.
Check the table names to be added (or re-added) to the dataset.
Note If the name of a table already in the dataset is cleared, it is not removed from the dataset. Clearing the name simply means it will not be re-added to the dataset.
If you are updating an existing dataset by adding tables, the following occurs:
- If the table was not previously in the dataset, its definition is merged into the dataset. Any tables, relationships, and other structures already in the dataset are left intact.
- If the table was previously in the dataset, the new table definition overrides the existing one. For example, if the new table definition has fewer columns, the columns are effectively removed from the dataset.
- Add this dataset to the designer
- Specifies whether to add code to the initialization of the current form to declare and instantiate the dataset being generated. You might choose not to create an instance:
- If you do not want to use the dataset on the current form (but instead will be using it in another component).
- If you are generating the dataset class simply in order to create a schema file.
The instance of the dataset uses the name of the dataset plus a sequential number. For example, if the dataset is named Dataset1, the first instance is named Dataset11, the second instance is named Dataset12, and so on. You can change the name of an instance on the form or component in the Properties window.
Introduction to Data Adapters | Creating Typed Datasets with the Component Designer