Share via


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 Dataset Designer. For more information, see Dataset Designer.

The typed dataset class generated as a result of this dialog box is stored in your project as two files: an .xsd file and a corresponding class (for example, .vb) file that incorporates the schema information.

You display the Generate Dataset dialog box by selecting one or more data adapters in a form or component and then clicking the Generate Dataset command on the shortcut menu.

User Interface Element List

  • 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 an instance of this dataset to the current form. 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.

See Also

Other Resources

Getting Started with Data Access

Connecting to Data in Visual Studio

Preparing Your Application to Receive Data

Fetching Data into Your Application

Displaying Data on Forms in Windows Applications

Editing Data in Your Application

Validating Data

Saving Data