Home

Database Visual Support: The Table Adapter

 

Introduction

After creating a data set and a data source, the database that holds the values is ready to make them available to your application. The next step is to indicate to each control where its data would come from. To assist you with this task, Microsoft Visual Studio includes a tool that allows you to create an object that can retrieve the values (data) from a table and make them available to the Windows controls. This object is called a table adapter.

 
 

Creating a Table Adapter

There are various ways you can create a table adapter:

  • If you had added a data source to your application and created a binding source, to create a table adapter, under the form, you can click the binding source object. In the Properties window, click the DisplayMember field and, from its combo, select the name of the table:
     
    Data Binding

    After doing this, Microsoft Visual Studio would create a table adapter. You can then accept or change its name
  • Probably the best way to create a table adapter consists of generating it from the Data Source window. To do this, after creating a data source, from the Data Source window, you can drag the table node and drop it on the form
     
    The Table Adapter
     
    After dropping the table, Microsoft Visual Studio would create both a data set and a table adapter.

Practical Learning Practical Learning: Creating a Table Adapter

  1. While the binding source is still selected under the form, in the Properties window, click DataMember and click the arrow its combo box to select RentalProperties
  2. Under the form, click rentalPropertiesTableAdapter and, in the Properties window, change its Name to tadRentalProperties
  3. Save the form

Published on Friday 04 January 2008


Previous Copyright © 2007 FunctionX, Inc. Next