Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Accessing Data
TableAdapters
 How to: Create TableAdapters

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Data Access in Client and Middle-Tier Programming
How to: Create TableAdapters

TableAdapters provide communication between your application and a database. More specifically, a TableAdapter connects to a database, executes queries or stored procedures, and either returns a new data table populated with the returned data or fills an existing DataTable with the returned data. TableAdapters are also used to send updated data from your application back to the database.

You can create TableAdapters by performing one of the following actions:

For an introduction to TableAdapters, see TableAdapter Overview.

NoteNote:

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 Visual Studio Settings.

The TableAdapter Configuration Wizard creates a single TableAdapter based on information that you provide to the wizard.

To create a TableAdapter with the TableAdapter Configuration Wizard

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

  2. Drag a TableAdapter from the DataSet tab of the Toolbox onto the design surface.

    The TableAdapter Configuration Wizard opens.

  3. Complete the wizard; a data table and TableAdapter are added to the dataset. For more information, see TableAdapter Configuration Wizard.

The Data Source Configuration Wizard creates a TableAdapter for each database object selected during the running of the wizard. After completing the Data Source Configuration Wizard, you can view the TableAdapters created by opening the dataset in the Dataset Designer. For more information, see How to: Open a Dataset in the Dataset Designer.

To create a TableAdapter with the Data Source Configuration Wizard

  1. Select Add New Data Source in the Data Sources Window. Choose Show Data Sources from the Data menu to open the Data Sources window.

    The Data Source Configuration Wizard opens.

  2. Complete the wizard, selecting either the Database or Web Service data-source type. For more information, see How to: Connect to Data in a Database or How to: Connect to Data in a Web Service.

A single TableAdapter is created for each database object that you drag onto the Dataset Designer.

To create a TableAdapter from Server Explorer database objects

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

  2. Drag a database object from a data connection in Server Explorer onto the Dataset Designer surface.

    A data table and TableAdapter are added to the dataset.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker