Was this helpful?
IngresDataAdapter Class
The IngresDataAdapter class represents a set of SQL statements and a database connection that are used to fill a DataSet and, optionally, update the Ingres database. The IngresDataAdapter object acts as a bridge between a .NET DataSet and the Ingres database for retrieving and updating data.
IngresDataAdapter Class Declaration
The declarations for the IngresDataAdapter class are:
C#: public sealed class IngresDataAdapter : DbDataAdapter, IDbDataAdapter, ICloneable
VB.NET: NotInheritable Public Class DataAdapter
Inherits DbDataAdapter
Implements IDbDataAdapter, ICloneable
IngresDataAdapter Class Example
public DataSet CreateDataSet(
    string dsName, string connectionString, string commandText)
{
    IngresConnection connection =
        new IngresConnection(connectionString);
    IngresCommand command =
        new IngresCommand(commandText, connection);
    IngresDataAdapter adapter = new IngresDataAdapter(command);
    DataSet ds = new DataSet();
    adapter.Fill(ds, dsName);
    return ds;
}
IngresDataAdapter Class Properties
The IngresDataAdapter class has the following properties:
Property
Accessor
Description
AcceptChangesDuringFill
get set
A true/false value indicating whether the DataRow.AcceptChanges method is called after the DataRow is added to the DataTable. Inherited from DataAdapter. Default is true.
ContinueUpdateOnError
get set
A true/false value indicating whether to generate an exception or to update the RowError property when an error occurs during an update to the row. Inherited from DataAdapter. Default is false.
DeleteCommand
get set
Command to be used (SQL statement or database procedure) to DELETE records from the database.
InsertCommand
get set
Command to be used (SQL statement or database procedure) to INSERT records into the database.
MissingMappingAction
get set
Action to be taken if incoming data does not have a matching table or column. Default is Passthrough. Inherited from DataAdapter.
MissingSchemaAction
get set
Action to be taken if an existing DataSet schema does not match incoming data. Inherited from DataAdapter. Default is Add.
SelectCommand
get set
Command to be used (SQL statement or database procedure) to SELECT records from the database.
TableMappings
get
The collection that provides the mapping between the returned records and the DataSet. Inherited from DataAdapter. Default is an empty collection.
UpdateBatchSize
get set
Enables or disables batch processing support (see Batch Statement Execution) and specifies the number of commands that can be executed in a batch. Inherited from DbDataAdapter. Default is 1 (batch is disabled).
UpdateCommand
get set
Command to be used (SQL statement or database procedure) to UPDATE records in the database.
IngresDataAdapter Class Public Methods
The public methods available to the IngresDataAdapter Class are:
Method
Description
Dispose
Releases allocated resources.
Fill
Adds or refreshes rows in the DataSet to match the values in the database. Inherited from DBDataAdapter.
FillSchema
Adds a DataTable to a DataSet and configures the schema to match that in the database. FillSchema does not add rows to a DataTable. Inherited from DBDataAdapter.
GetFillParameters
Gets an array of IDataParameter objects that contain the parameters set by the user when executing a SELECT statement. Inherited from DBDataAdapter.
Update
Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet. Inherited from DBDataAdapter.
IngresDataAdapter Class Events
The events generated by the IngresDataAdapter class are:
Event
Description
FillError
Raised when an error occurs during a Fill operation. Inherited from DBDataAdapter.
RowUpdating
Raised as an UPDATE, INSERT, or DELETE operation on a row (by a call to one of the Update methods) is about to start.
RowUpdated
Raised after an UPDATE, INSERT, or DELETE operation on a row (by a call to one of the Update methods) is complete.
IngresDataAdapter Class Constructors
The IngresDataAdapter class contains the following constructors:
Constructor Overloads
Description
IngresDataAdapter()
Instantiates a new instance of the IngresDataAdapter class using default property values
IngresDataAdapter
(IngresCommand)
Instantiates a new instance of the IngresDataAdapter class using the defined IngresCommand as the SelectCommand.
IngresDataAdapter
(string, IngresConnection)
Instantiates a new instance of the IngresDataAdapter class using the defined command text for a new instance of IngresCommand for the SelectCommand, and the IngresConnection object
IngresDataAdapter
(string, string)
Instantiates a new instance of the IngresDataAdapter class using the defined command text for the SelectCommand and a connection string
Batch Statement Execution
The IngresDataAdapter class supports batch processing through the UpdateBatchSize property. This property directs the data adapter to gather several INSERT, UPDATE, and DELETE statements and their parameter sets from a DataSet or DataTable into a single block and send it to the server instead of processing one operation at a time.
The IngresDataAdapter is the Ingres/Vector implementation of the .NET DbDataAdapter class and can be used to manage the flow of Ingres data between the .NET application and the Ingres data source. The data adapter contains the SELECT command to fill a DataTable with DataRows and also contains the INSERT, UPDATE, and DELETE commands to update the database. As the application makes updates in the DataTable, the value and state change of each DataRow is recorded in the DataRow but the changes are not committed to the database until the application calls the data adapter's Update() method. When the method is called, the data adapter sweeps the DataRows of the DataTable. If the DataRow has a RowState of Added, Changed, or Deleted, the data adapter invokes the respective INSERT, UPDATE, or DELETE command.
The Microsoft .NET Framework allows a .NET application to specify that the updates be gathered into a batch by the DbDataAdapter for processing by the database. You can use the UpdateBatchSize property of the .NET DbDataAdapter to control the batch size. An UpdateBatchSize value of 1 (the default) disables batch processing—that is, each update is processed individually in a call to the database server. An UpdateBatchSize > 1 specifies the number of rows to be updated by the batch. If UpdateBatchSize is set to 0 then the batch size is left to the discretion of the data provider.
The value you choose for UpdateBatchSize depends on the application and its environment. The slower the channel between the client and server machines, the better the relative performance will be due to batch support. The benefit of .NET batch is that fewer I/Os result in reduced elapsed time. While some batch sizes will have a dramatic improvement in rows processed per second, increasingly larger batch sizes will reach a point of diminishing returns as the constant database processing time overshadows the decreasing I/O time. Experimentation in the client/server system will suggest a good value for UpdateBatchSize that balances I/Os, CPU, memory resources, .NET Garbage Collection (GC) timing, server resources to process the batch, and overall performance. A good starting value for UpdateBatchSize is 1000. A higher or lower value may be better for your environment.
The data adapter and UpdateBatchSize property can be used to bulk load a database table. A .NET DataTable is loaded with the new rows, the DataTable is associated with the IngresDataAdapter, the IngresDataAdapter.UpdateBatchSize is set to an efficient value > 1, and the IngresDataAdapter.Update() method invoked to drive a batch of rows to be INSERTed instead of one row at a time. Faster batched inserts can be achieved if the following conditions are met:
Inserts must be into a base table (not an updatable view or index).
The table should not have any rules or integrities (while they are allowed, they slow processing).
The table must not be a gateway table (for example, an IMA table, security audit log file, or an Enterprise Access table).
Last modified date: 01/30/2023