DATA ADAPTERS

A data adapter transfers data between a connection and a DataSet. This object’s most important methods are Fill and Update, which move data from and to the database, respectively. A data adapter also provides properties and other methods that can be useful. The following table describes the object’s most useful properties.

PROPERTY PURPOSE
DeleteCommand The command object that the adapter uses to delete rows.
InsertCommand The command object that the adapter uses to insert rows.
SelectCommand The command object that the adapter uses to select rows.
TableMappings A collection of DataTableMapping objects that determine how tables in the database are mapped to tables in the DataSet. Each DataTableMapping object has a ColumnMappings collection that determines how the columns in the database table are mapped to columns in the DataSet table.
UpdateCommand The command object that the adapter uses to update rows.

You can create the command objects in a couple of ways. For example, if you use the Data Adapter Configuration Wizard (described shortly) to build the adapter at design time, the wizard automatically creates these objects. You can select the adapter and expand these objects in the Properties window to read their properties, including the CommandText property that defines the commands.

Another way to create these commands is to use a command builder object. If you attach a command builder to a data adapter, the adapter uses the command builder to ...

Get Visual Basic 2012 Programmer's Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.