Udostępnij za pośrednictwem


How to: Edit TableAdapters

You edit a TableAdapter when you want to change the schema of the adapter's table and the Fill method that fills the TableAdapter's associated data table. TableAdapters are created with a main Fill method that defines the schema of the associated data table. The main Fill method is based on the query or stored procedure you entered when you originally configured the TableAdapter; it is the first (topmost) method under the data table on the Dataset Designer.

TableAdapter with multiple queries

Any changes that you make to the TableAdapter's main Fill method are reflected in the schema of the associated data table. For example, removing a column from the query in the main Fill method also removes the column from the associated data table. Additionally, removing the column from the main Fill method removes the column from any additional queries for that TableAdapter.

You edit TableAdapters with the TableAdapter Configuration Wizard in the Dataset Designer.

Note

If the TableAdapter Query Configuration Wizard opens instead of the TableAdapter Configuration Wizard, you might have selected one of the TableAdapter's additional queries and not the original TableAdapter or main Fill query. For information about editing the additional queries of a TableAdapter, see How to: Edit TableAdapter Queries.

To edit a TableAdapter

  1. Open the dataset in the Dataset Designer. For more information, see How to: Open a Dataset in the Dataset Designer.

  2. Select the TableAdapter you want to edit.

  3. Right-click the TableAdapter name and click Configure.

    The TableAdapter Configuration Wizard opens, ready for you to modify the query or stored procedure that fills the TableAdapter's associated data table.

  4. Complete the TableAdapter Configuration Wizard with the changes you want.

See Also

Tasks

How to: Create TableAdapter Queries

Concepts

Preparing Your Application to Receive Data

Fetching Data into Your Application

Binding Controls to Data in Visual Studio

Editing Data in Your Application

Validating Data

Saving Data

Other Resources

TableAdapters

Connecting to Data in Visual Studio

Data Walkthroughs