How to: Start the TableAdapter Query Configuration Wizard
The TableAdapter Query Configuration Wizard helps create and edit the additional queries you can add to TableAdapters. A TableAdapter query is any valid SQL query or stored procedure that returns either data conforming to the same schema as the TableAdapter's associated data table or a scalar value.
Note
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.
To start the TableAdapter Query Configuration wizard with a new query
Open your dataset in the Dataset Designer. For more information, see How to: Open a Dataset in the Dataset Designer.
If you are creating a new query, drag a Query object from the DataSet tab of the Toolbox onto a DataTable, or select Add Query from the TableAdapter's shortcut menu. You can also drag a Query object onto an empty area of the Dataset Designer, which creates a TableAdapter without an associated DataTable. These queries are limited to returning single values (scalar), or executing UPDATE, INSERT, or DELETE commands against the database. For more information, see How to: Add Global Queries to a Dataset.
On the Choose Your Data Connection page select or create the connection the query will use.
Note
This page only appears when the designer cannot determine the proper connection to use, or when no connections are available.
On the Choose a Command Type page, select from the following methods of fetching data from the database:
Use SQL statements allows you to type a SQL statement to select the data from your database.
Create new stored procedure — Select this option to have the wizard create a new stored procedure (in the database) based on the specified SELECT statement.
Use existing stored procedures — Select this option to execute an existing stored procedure when running the query.
To start the TableAdapter Query Configuration wizard on an existing query
If you are editing an existing TableAdapter query, right-click the query, and choose Configure from the shortcut menu.
Note
Right-clicking the main query of a TableAdapter reconfigures the TableAdapter and DataTable schema, whereas right-clicking an additional query on a TableAdapter only configures the selected query. The TableAdapter Configuration Wizard reconfigures the TableAdapter definition; the TableAdapter Query Configuration Wizard reconfigures only the selected query.
See Also
Tasks
How to: Connect to Data in a Database
Walkthrough: Displaying Data on a Windows Form
Concepts
Binding Windows Forms Controls to Data in Visual Studio
Creating and Editing Typed Datasets