Data Adapter Preview Dialog Box
Allows you to see how data will be filled into a dataset when an adapter's SelectCommand object is invoked. Using this dialog box allows you to test that the adapter is returning the data you expect, that any table mappings work properly, and that there are no errors when you fill the dataset. The dialog box also allows you test the effect of passing different parameter values to the adapter.
Previewing a data adapter is particularly useful if you are going to use it to fill a dataset that was not generated directly from the adapter.
The dialog box appears when you perform either of the following actions:
- Select Preview Data from the Data menu. This menu is available only when a data adapter has been added to a form or component.
- Click the Preview Data link at the bottom of the Properties window. This link is available when you are displaying properties for a data adapter.
- Data adapters
- Lists the data adapters available on the form or component you are working with. Select the adapter you want to preview. To show the results of using all data adapters, select <All data adapters>.
- Fill Dataset
- Executes the command and display the data in the Results box.
If an error occurs while the data adapter is filling data into the dataset, the error is displayed in a message box. Possible errors include:
- Data type mismatches.
- Syntax errors in the SQL statement or stored procedure being executed.
- Table mapping errors. For example, if an adapter's MissingMappingAction or MissingSchemaAction properties are set to Error, and if the table mappings do not completely describe what to do with mismatched column names in the database and dataset, an error is raised.
- Connection problems.
- Displays parameters required for the SQL Select statement or the stored procedure referenced in the SelectCommand object of the specified data adapter or adapters. If no parameters are required, this grid is blank.
Each parameter is displayed as a row in the grid with the parameter name and data type filled in. Enter a value for each parameter in the Value box. Alternatively, if the parameter accepts this, you can select <DEFAULT> or <NULL> from the drop-down list in the Value box.
- Target dataset
- Specifies the dataset into which the preview command should fill data. You can select from all available datasets in your project or you can select to fill in an untyped dataset (one without a schema).
- Data tables
- Displays a list of the data tables in the dataset. Select a table name to see the records filled in by the data adapter. (Usually, each data adapter fills one table in the dataset.) If more than one table has been filled, you can select a table in this list to see the results for that table.
- Displays the data in the dataset. The box shows how the data will appear after being returned from the database and after any table mappings have been applied. The data in the grid is read-only.
If there is more than one table in the results, you can view the contents of a specific table by selecting its name in the Data table list.
- Clear Results
- Clears all data in the selected table. To clear all tables, select each one in the Data tables list and click Clear Results for each one.
Introduction to Data Adapters | Creating Data Adapters | Previewing Data-Adapter Results | Table Mapping in Data Adapters | Data Walkthroughs