IDataAdapter Interface
Allows an object to implement a DataAdapter, and represents a set of methods and mapping action-related properties that are used to fill and update a DataSet and update a data source.
Assembly: System.Data (in System.Data.dll)
The IDataAdapter interface allows an inheriting class to implement a DataAdapter class, which represents the bridge between a data source and a DataSet. For more information about DataAdapter classes, see Populating a DataSet from a DataAdapter (ADO.NET).
An application does not create an instance of the IDbDataAdapter interface directly, but implements an instance of a class that inherits IDbDataAdapter.
Classes that inherit IDataAdapter must implement the inherited members, and they typically define additional members to add provider-specific functionality. For example, the IDataAdapter interface defines a Fill method that takes a DataSet as a parameter. In turn, the OleDbDataAdapter class inherits the Fill method and also defines two additional overloads of the Fill method that take an ADO Recordset object as a parameter.
Notes to Implementers:To promote consistency among .NET Framework data providers, name the inheriting class in the form Prv DataAdapter where Prv is the uniform prefix given to all classes in a specific .NET Framework data provider namespace. For example, Sql is the prefix of the SqlDataAdapter class in the System.Data.SqlClient namespace.
When you inherit from the IDataAdapter interface, you should implement the following constructors:
Item | Description |
|---|---|
PrvDataAdapter() | Initializes a new instance of the PrvDataAdapter class. |
PrvDataAdapter(PrvCommand selectCommand) | Initializes a new instance of the PrvDataAdapter class by using the specified SQL SELECT statement. |
PrvDataAdapter(string selectCommandText, string selectConnectionString) | Initializes a new instance of the PrvDataAdapter class by using an SQL SELECT statement and a connection string. |
PrvDataAdapter(string selectCommandText, PrvConnection selectConnection) | Initializes a new instance of the PrvDataAdapter class by using an SQL SELECT statement and a PrvConnection object. |
The following example uses the derived classes, SqlCommand, SqlDataAdapter, and SqlConnection, to select records from a database. The filled DataSet is then returned. To do this, the method is passed an initialized DataSet, a connection string, and a query string that is a Transact-SQL SELECT statement.
Public Function SelectRows( _ ByVal dataSet As DataSet, ByVal connectionString As String, _ ByVal queryString As String) As DataSet Using connection As New SqlConnection(connectionString) Dim adapter As New SqlDataAdapter() adapter.SelectCommand = New SqlCommand( _ queryString, connection) adapter.Fill(dataSet) Return dataSet End Using End Function
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.