.NET Framework Class Library IDbDataAdapter Interface Represents a set of command-related properties that are used to fill the DataSet and update a data source, and is implemented by .NET Framework data providers that access relational databases.
Namespace:
System.Data
Assembly:
System.Data (in System.Data.dll)

Syntax
Public Interface IDbDataAdapter _
Inherits IDataAdapter
public interface IDbDataAdapter : IDataAdapter
public interface class IDbDataAdapter : IDataAdapter
type IDbDataAdapter =
interface
interface IDataAdapter
end
The IDbDataAdapter type exposes the following members.

Methods

Remarks
The IDbDataAdapter interface inherits from the IDataAdapter interface and allows an object to create a DataAdapter designed for use with a relational database. The IDbDataAdapter interface and, optionally, the utility class, DbDataAdapter, allow 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). For more information about implementing .NET Framework data providers, see [<topic://cpconimplementingnetdataprovider>]. An application does not create an instance of the IDbDataAdapter interface directly, but creates an instance of a class that inherits IDbDataAdapter and DbDataAdapter. Classes that inherit IDbDataAdapter must implement the inherited members, and typically define additional members to add provider-specific functionality. For example, the IDbDataAdapter interface defines the SelectCommand property, and the DbDataAdapter interface defines a Fill method that takes a DataTable as a parameter. In turn, the OleDbDataAdapter class inherits the SelectCommand property and the Fill method, and also defines two additional overloads of the Fill method that take an ADO Recordset object as a parameter. Notes to ImplementersTo 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 IDbDataAdapter 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 with the specified SQL SELECT statement. | PrvDataAdapter(string selectCommandText, string selectConnectionString) | Initializes a new instance of the PrvDataAdapter class with an SQL SELECT statement and a connection string. | PrvDataAdapter(string selectCommandText, PrvConnection selectConnection) | Initializes a new instance of the PrvDataAdapter class with an SQL SELECT statement and a PrvConnection object. |

Examples
The following example uses the derived classes, SqlCommand, SqlDataAdapter and SqlConnection, to select records from a data source. The filled DataSet is then returned. To accomplish 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
private static DataSet SelectRows(DataSet dataset,
string connectionString,string queryString)
{
using (SqlConnection connection =
new SqlConnection(connectionString))
{
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand(
queryString, connection);
adapter.Fill(dataset);
return dataset;
}
}

Version Information
.NET FrameworkSupported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileSupported in: 4, 3.5 SP1

Platforms
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

See Also
|
Biblioteca de clases de .NET Framework IDbDataAdapter (Interfaz) Representa un conjunto de propiedades relacionadas con comandos que se utilizan para rellenar DataSet y actualizar un origen de datos, y la implementan los proveedores de datos de .NET Framework que tienen acceso a bases de datos relacionales.
Espacio de nombres:
System.Data
Ensamblado:
System.Data (en System.Data.dll)

Sintaxis
Public Interface IDbDataAdapter _
Inherits IDataAdapter
public interface IDbDataAdapter : IDataAdapter
public interface class IDbDataAdapter : IDataAdapter
type IDbDataAdapter =
interface
interface IDataAdapter
end
El tipo IDbDataAdapter expone los siguientes miembros.

Comentarios
La interfaz IDbDataAdapter hereda de la interfaz IDataAdapter y permite que un objeto cree un DataAdapter diseñado para utilizarlo con una base de datos relacional. La interfaz IDbDataAdapter y, de forma opcional, la clase de utilidad DbDataAdapter permiten que una clase heredada implemente una clase DataAdapter, que representa el puente entre un origen de datos y un DataSet. Para obtener más información sobre las clases DataAdapter, vea Rellenar un objeto DataSet desde un objeto DataAdapter (ADO.NET). Para obtener más información sobre la implementación de proveedores de datos de .NET Framework, vea [<topic://cpconimplementingnetdataprovider>]. Una aplicación no crea una instancia de la interfaz IDbDataAdapter directamente, sino que crea una instancia de una clase que hereda IDbDataAdapter y DbDataAdapter. Las clases que heredan de IDbDataAdapter deben implementar los miembros heredados y suelen definir miembros adicionales para agregar la funcionalidad específica de proveedor. Por ejemplo, la interfaz IDbDataAdapter define la propiedad SelectCommand y la interfaz DbDataAdapter define un método Fill que utiliza un DataTable como parámetro. A su vez, la clase OleDbDataAdapter hereda la propiedad SelectCommand y el método Fill y también define dos sobrecargas adicionales del método Fill que un objeto ADO Recordset toma como parámetro. Notas para los implementadoresPara potenciar la coherencia entre los proveedores de datos de .NET Framework, asigne a la clase heredada un nombre con el formato Prv DataAdapter, donde Prv es el prefijo uniforme que se asigna a todas las clases de un espacio de nombres de proveedor de datos de .NET Framework específico. Por ejemplo, Sql es el prefijo de la clase SqlDataAdapter en el espacio de nombres System.Data.SqlClient. Al heredar de la interfaz IDbDataAdapter, se deben implementar los siguientes constructores: Elemento | Descripción |
|---|
PrvDataAdapter() | Inicializa una nueva instancia de la clase PrvDataAdapter. | PrvDataAdapter(PrvCommand selectCommand) | Inicializa una nueva instancia de la clase PrvDataAdapter con la instrucción SELECT de SQL especificada. | PrvDataAdapter(string selectCommandText, string selectConnectionString) | Inicializa una nueva instancia de la clase PrvDataAdapter con una instrucción SELECT de SQL y una cadena de conexión. | PrvDataAdapter(string selectCommandText, PrvConnection selectConnection) | Inicializa una nueva instancia de la clase PrvDataAdapter con una instrucción SELECT de SQL y un objeto PrvConnection. |

Ejemplos
En el ejemplo siguiente se utilizan las clases derivadas SqlCommand, SqlDataAdapter y SqlConnection para seleccionar registros de un origen de datos. A continuación, se devuelve DataSet rellenado. Para realizar esto, al método se le pasa un DataSet inicializado, una cadena de conexión y una cadena de consulta, que es una instrucción SELECT de Transact-SQL.
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
private static DataSet SelectRows(DataSet dataset,
string connectionString,string queryString)
{
using (SqlConnection connection =
new SqlConnection(connectionString))
{
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand(
queryString, connection);
adapter.Fill(dataset);
return dataset;
}
}

Información de versión
.NET FrameworkCompatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client ProfileCompatible con: 4, 3.5 SP1

Plataformas
Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2
.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Vea también
|