Sugerir traducción
 
Otros han sugerido:

progress indicator
No hay más sugerencias.
Evaluar y enviar comentarios
Contraer todo/Expandir todo Contraer todo
Ver contenido:  en paraleloVer contenido: en paralelo
.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)
Visual Basic
Public Interface IDbDataAdapter _
    Inherits IDataAdapter
C#
public interface IDbDataAdapter : IDataAdapter
Visual C++
public interface class IDbDataAdapter : IDataAdapter
F#
type IDbDataAdapter =  
    interface
        interface IDataAdapter
    end

The IDbDataAdapter type exposes the following members.

  NameDescription
Public propertySupported by the XNA FrameworkDeleteCommandGets or sets an SQL statement for deleting records from the data set.
Public propertySupported by the XNA FrameworkInsertCommandGets or sets an SQL statement used to insert new records into the data source.
Public propertySupported by the XNA FrameworkMissingMappingActionIndicates or specifies whether unmapped source tables or columns are passed with their source names in order to be filtered or to raise an error. (Inherited from IDataAdapter.)
Public propertySupported by the XNA FrameworkMissingSchemaActionIndicates or specifies whether missing source tables, columns, and their relationships are added to the dataset schema, ignored, or cause an error to be raised. (Inherited from IDataAdapter.)
Public propertySupported by the XNA FrameworkSelectCommandGets or sets an SQL statement used to select records in the data source.
Public propertySupported by the XNA FrameworkTableMappingsIndicates how a source table is mapped to a dataset table. (Inherited from IDataAdapter.)
Public propertySupported by the XNA FrameworkUpdateCommandGets or sets an SQL statement used to update records in the data source.
Top
  NameDescription
Public methodSupported by the XNA FrameworkFillAdds or updates rows in the DataSet to match those in the data source using the DataSet name, and creates a DataTable named "Table". (Inherited from IDataAdapter.)
Public methodSupported by the XNA FrameworkFillSchemaAdds a DataTable named "Table" to the specified DataSet and configures the schema to match that in the data source based on the specified SchemaType. (Inherited from IDataAdapter.)
Public methodSupported by the XNA FrameworkGetFillParametersGets the parameters set by the user when executing an SQL SELECT statement. (Inherited from IDataAdapter.)
Public methodSupported by the XNA FrameworkUpdateCalls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified DataSet from a DataTable named "Table". (Inherited from IDataAdapter.)
Top

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 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 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.

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.

Visual Basic
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
C#
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;
    }
}

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.
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)
Visual Basic
Public Interface IDbDataAdapter _
    Inherits IDataAdapter
C#
public interface IDbDataAdapter : IDataAdapter
Visual C++
public interface class IDbDataAdapter : IDataAdapter
F#
type IDbDataAdapter =  
    interface
        interface IDataAdapter
    end

El tipo IDbDataAdapter expone los siguientes miembros.

  NombreDescripción
Propiedad públicaCompatible con XNA FrameworkDeleteCommandObtiene o establece una instrucción SQL para eliminar registros del conjunto de datos.
Propiedad públicaCompatible con XNA FrameworkInsertCommandObtiene o establece una instrucción SQL utilizada para insertar nuevos registros en el origen de datos.
Propiedad públicaCompatible con XNA FrameworkMissingMappingActionIndica o especifica si las tablas o columnas de origen no asignadas se pasan con sus nombres de origen, para que se filtren o para generar un error. (Se hereda de IDataAdapter).
Propiedad públicaCompatible con XNA FrameworkMissingSchemaActionIndica o especifica si las tablas y columnas de origen y las relaciones entre ellas que faltan se agregan al esquema del conjunto de datos, se omiten o hacen que se genere un error. (Se hereda de IDataAdapter).
Propiedad públicaCompatible con XNA FrameworkSelectCommandObtiene o establece una instrucción SQL utilizada para seleccionar registros en el origen de datos.
Propiedad públicaCompatible con XNA FrameworkTableMappingsIndica cómo se asigna una tabla de origen a una tabla de conjuntos de datos. (Se hereda de IDataAdapter).
Propiedad públicaCompatible con XNA FrameworkUpdateCommandObtiene o establece una instrucción SQL utilizada para actualizar registros en el origen de datos.
Arriba
  NombreDescripción
Método públicoCompatible con XNA FrameworkFillAgrega filas a la clase DataSet o las actualiza para hacerlas coincidir con las del origen de datos mediante el nombre de DataSet y crea un objeto DataTable denominado "Table". (Se hereda de IDataAdapter).
Método públicoCompatible con XNA FrameworkFillSchemaAgrega un objeto DataTable denominado "Table" a la interfaz DataSet que se ha especificado y configura el esquema para que coincida con el del origen de datos en función de la SchemaType especificada. (Se hereda de IDataAdapter).
Método públicoCompatible con XNA FrameworkGetFillParametersObtiene los parámetros establecidos por el usuario al ejecutar una instrucción SELECT de SQL. (Se hereda de IDataAdapter).
Método públicoCompatible con XNA FrameworkUpdateLlama a las instrucciones INSERT, UPDATE o DELETE respectivas para cada fila insertada, actualizada o eliminada en la clase DataSet especificada a partir de un objeto DataTable denominado "Table". (Se hereda de IDataAdapter).
Arriba

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 implementadores

Para 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.

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.

Visual Basic
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
C#
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;
    }
}

.NET Framework

Compatible con: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

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.
Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2012 Microsoft. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker