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

Namespace:  System.Data
Assembly:  System.Data (in System.Data.dll)
Visual Basic
Public Interface IDataAdapter
C#
public interface IDataAdapter
Visual C++
public interface class IDataAdapter
F#
type IDataAdapter =  interface end

The IDataAdapter type exposes the following members.

  NameDescription
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.
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.
Public propertySupported by the XNA FrameworkTableMappingsIndicates how a source table is mapped to a dataset table.
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".
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.
Public methodSupported by the XNA FrameworkGetFillParametersGets the parameters set by the user when executing an SQL SELECT statement.
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".
Top

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.

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
IDataAdapter (Interfaz)

Permite que un objeto implemente un DataAdapter. Representa un conjunto de métodos y propiedades relacionadas con acciones de asignación que se usan para rellenar y actualizar un DataSet y actualizar un origen de datos.

Espacio de nombres:  System.Data
Ensamblado:  System.Data (en System.Data.dll)
Visual Basic
Public Interface IDataAdapter
C#
public interface IDataAdapter
Visual C++
public interface class IDataAdapter
F#
type IDataAdapter =  interface end

El tipo IDataAdapter expone los siguientes miembros.

  NombreDescripción
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.
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.
Propiedad públicaCompatible con XNA FrameworkTableMappingsIndica cómo se asigna una tabla de origen a una tabla de conjuntos 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".
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.
Método públicoCompatible con XNA FrameworkGetFillParametersObtiene los parámetros establecidos por el usuario al ejecutar una instrucción SELECT de SQL.
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".
Arriba

La interfaz IDataAdapter permite 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).

Una aplicación no crea una instancia de la interfaz IDbDataAdapter directamente, sino que implementa una instancia de una clase que hereda IDbDataAdapter.

Las clases que heredan IDataAdapter deben implementar los miembros heredados y suelen definir miembros adicionales para agregar la funcionalidad específica del proveedor. Por ejemplo, la interfaz IDataAdapter define un método Fill que toma un DataSet como parámetro. A su vez, la clase OleDbDataAdapter hereda el método Fill y también define dos sobrecargas adicionales del método Fill que toman un objeto ADO Recordset 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 IDataAdapter, 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 usan las clases derivadas SqlCommand, SqlDataAdapter y SqlConnection para seleccionar registros de una base de datos. A continuación, se devuelve DataSet rellenado. Para hacer 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