Data Set Designer/Table Adapter Wizard Test with SQL Statements
The Data Set Designer/Table Adapter Wizard Test using SQL statements extends the Data Set Designer Drag-and-Drop Test by adding manipulation of SQL statements to data-source objects dropped onto the DataSet designer from the Visual Studio Server Explorer.
Test Procedure
Create a new Windows Application project.
Add a DataSet project item.
From the Toolbox, drag a TableAdapter to the Dataset designer. The TableAdapter Configuration Wizard appears.
On the Choose Your Data Connection page, add a connection to the database using the generic provider.
Make sure the connection is selected in the combo box and click Next.
On the Save the Connection String to the Application Configuration File page, click Next.
On the Choose the Command Type page, select the Use SQL statements option and click Next. The SQL pane is now visible.
Click the Query Builder button to graphically design your SQL string (or, altneratively, you can type a SQL statement directly in the SQL pane).
Verify that the results are as expected by executing the query in Query Builder, and then click OK to dismiss the Query Builder.
Click Next.
On the Choose Methods to Generate page, leave the default values and click Next.
On the Wizard Results Page, click Finish.
A TableAdapter is created using the SQL statement you entered. Verify the following in the designer:
The DataTable and TableAdapter names
Columns created for the DataTable
The configuration of the Insert, Update, and Delete commands for the CommandText property and Parameters collection
Repeat steps 3–10 with the following types of SQL statements:
SELECT * FROM Table
SELECT * FROM TableWithoutPrimaryKey
SELECT * FROM TableWithMultipleColumnPrimaryKey
SELECT <some columns> FROM Table
SELECT <different datatypes> FROM Table
SELECT * FROM Table WHERE Column=<NamedParameter>
SELECT * FROM View
SELECT * FROM Function