Comments/Troubleshooting

No reference is maintained between the DataSet, the DataAdapter , and the Connection. After the DataAdapter retrieves data from a data source into a DataSet, the DataSet has no information about the connection, database, tables, columns, or any other details about the source of the data.

Because the DataAdapter is a connected class, each .NET data provider implements its own DataAdapter, with a similar interface and function to other DataAdapter classes but in its own unique namespace. The DataAdapter class namespaces for several ADO.NET data providers are listed in Table 29-1.

Table 29-1. Provider-specific DataAdapter classes

Class

Data source

System.Data.SqlClient.SqlDataAdapter

SQL Server

System.Data.OleDb.OleDbDataAdapter

OLE DB provider

Microsoft.Data.Odbc.OdbcDataAdapter

ODBC driver

System.Data.OracleClient.OracleDataAdapter

Oracle

The commonly used public properties of the DataAdapter class are listed in Table 29-2.

Table 29-2. DataAdapter properties

Property

Description

AcceptChangesDuringFill

Gets or sets a value indicating whether the row is committed when added to a table using the Fill( ) method.

ContinueUpdateOnError

Gets or sets a value indicating whether the DataAdapter should raise an exception and stop processing remaining updates when an error is encountered.

DeleteCommand

Gets or sets the command, either a SQL statement or a stored procedure, that deletes the DataSet records marked for deletion from the data source when ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

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