Udostępnij za pośrednictwem


How to: View the Queries in a TableAdapter

A TableAdapter can contain several queries:

  • The main Fill query, which is used to define the schema of the TableAdapter's data table.

  • Additional queries that can be used to fill the table as well (the additional queries do not define the schema of the table, but they do need to return data that conforms to that schema, or return a scalar value).

  • Additionally, depending on the structure of the main Fill query, a TableAdapter can contain INSERT, UPDATE, and DELETE queries (typically referred to as commands) that are used to send updated data back to the database.

TableAdapter with multiple queries:

TableAdapter with multiple queries

To view these queries, use the following procedures to open them in the designer:

Viewing a TableAdapter's Main Fill Query

To view a TableAdapter's main Fill query

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

  2. Right-click the TableAdapter's title bar and choose Configure.

    The TableAdapter Configuration Wizard opens, displaying the SQL statement used to fill the table or the stored procedure that is called to fill the table.

Viewing a TableAdapter's INSERT, UPDATE, and DELETE Commands

To view a TableAdapter's updating commands

  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 by clicking its title bar.

  3. In the Properties window, locate and expand the command you want to view.

  4. The SQL statement or stored procedure name is viewable in the CommandText property.

Viewing One of the TableAdapter's Additional Queries

To view a TableAdapter query

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

  2. Right-click the TableAdapter query you want to view and select Configure.

    The TableAdapter Query Configuration Wizard opens, displaying the SQL statement used to fill the table or the stored procedure that is called to fill the table.

See Also

Other Resources

TableAdapters

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

Data Walkthroughs