Table Mappings Dialog Box

Allows you to specify which columns in a database table or other data source are equivalent to columns in a dataset table. It is displayed when you click the ellipsis (...) button next to the TableMappings property of a data adapter in the Properties window.

Mapping is useful in these situations:

  • The dataset was created from an existing schema that uses names different from those in the data source.

  • You want to change data element names in the dataset for convenience, readability, translation to or from a foreign language, or another reason.

  • You want to control the names of typed data members when you generate a dataset from the adapter.

  • A column name from the data source is a reserved word in your programming language. For example, using the column name Region in a typed dataset in Visual Basic causes an error, because the code generated for this column conflicts with the reserved word of that name.

  • You want to use fewer columns in the dataset than are returned by the dataset command. This might happen if you are using an existing stored procedure to fill a new dataset.

  • Use a dataset to suggest table and column names
    When selected, uses the schema of an existing dataset as the model for table and column names to map to.

    Note

    You can use this option even if you are not intending to fill the selected dataset using the current adapter. The schema is used only to get a list of names.

  • Dataset
    Allows you to select a dataset to use as a model.

  • Source table
    If the adapter references more than one table in the data source, select the table for which you are mapping column names.

  • Dataset table
    If you chose a dataset to use as the model, select the table containing the column names to use as mapping names. If the dataset contains only one table, it is referred to as Table.

  • Column mappings
    Displays how columns are mapped between the source table and dataset table. When the adapter fills a dataset, it reads information from the columns in the source-columns fields and writes it to the fields whose names are listed in the corresponding dataset columns fields.

    • **Source Columns   **Displays a list of the column names in the data source.

    • **Dataset Columns   **Displays the names of columns in the dataset to write data to during a fill operation, and to read data from during an update operation.

    You can adjust the mappings in the following ways:

    • Edit a mapping by changing the source or dataset column name. Use the drop-down list to select a new name, or type a name into the box. Doing this causes the data to be written to a different column in the dataset table during a fill operation.

    • Delete a mapping by selecting a grid row and clicking the delete button. This option is useful if the adapter returns more columns than you need in the dataset.

    • Add a new mapping by filling in new source and dataset column names in the blank row at the bottom of the grid. You might do this if you know that at run time, the adapter or the dataset will contain columns that are not available to you while using this dialog box.

      Note

      The order of the columns is not important in the mapping.

  • Reset
    Returns mappings to their default value, which is to make the dataset names the same as the names in the data source.

See Also

Reference

Data Adapter Configuration Wizard