Represents a set of data commands and a connection to a database that are used to fill the DataSet and update the database.
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Data.Common.DataAdapter
System.Data.Common.DbDataAdapter
IBM.Data.DB2.DB2DataAdapter
[Visual Basic]
NotInheritable Public Class DB2DataAdapter
Inherits DbDataAdapter
Implements IDbDataAdapter
[C#]
public sealed class DB2DataAdapter : DbDataAdapter, IDbDataAdapter
[C++]
public __gc __sealed class DB2DataAdapter : public DbDataAdapter,
IDbDataAdapter
[JScript]
public class DB2DataAdapter extends DbDataAdapter implements
IDbDataAdapter
The DB2DataAdapter serves as a bridge between a DataSet and database for retrieving and saving data. The DB2DataAdapter provides this bridge by using Fill to load data from the database into the DataSet, and using Update to send changes made in the DataSet back to the database.
The DB2DataAdapter also includes the SelectCommand, InsertCommand, DeleteCommand, UpdateCommand, and TableMappings properties to facilitate loading and updating of data.
[Visual Basic, C#] The following example uses DB2®Command , DB2DataAdapter and DB2Connection to select records, and populate a DataSet with the selected rows. The filled DataSet is then returned. To accomplish this, the method is passed an initialized DataSet, with the SelectCommand set with the specified SQL SELECT statement and a connection to the database.
[Visual Basic]
Public Function SelectDB2SrvRows(dataSet As DataSet,
connection As String, query As String) As DataSet
Dim conn As New DB2Connection(connection)
Dim adapter As New DB2DataAdapter()
adapter.SelectCommand = new DB2Command(query, conn)
adapter.Fill(dataset)
Return dataset
End Function
[C#]
public DataSet SelectDB2SrvRows(DataSet dataset,string connection,string query)
{
DB2Connection conn = new DB2Connection(connection);
DB2DataAdapter adapter = new DB2DataAdapter();
adapter.SelectCommand = new DB2Command(query, conn);
adapter.Fill(dataset);
return dataset;
}
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.