1.1.1

Table Of Contents
command.Prepare();
int stCount = 0; // batch statements count
for (int i = 0; i < numRecords; i++)
{
command.Parameters[0] = <order_id>;
command.Parameters[1] = <order_date>;
command.Parameters[2] = <ship_date>;
command.Parameters[3] = <customer_id>;
command.Parameters[4] = <subtotal>;
// Add statement to command's batch
command.AddBatch();
// Execute Batch statements when batch size is reached and reset
if ((++stCount) == batchSize)
{
command.ExecuteBatch();
stCount = 0;
}
}
// Execute the remaining statements in the batch
command.ExecuteBatch();
}
catch (Exception e)
{
///
/// Log or re-throw exception
///
}
finally
{
connection.Close();
}
Generic Coding with the SQLFire ADO.NET Driver
This release of the ADO.NET driver does not support DbProviderFactory. However, all implementation classes
extend the corresponding classes in the System.Data.Common namespace. This allows applications to use the
base classes of that namespace in the code and resort to SQLFire-specic classes only for creating class objects,
or when SQLFire-specic methods must be invoked.
If an application creates a SQLFClientConnection explicitly, then it can continue to use the base DbConnection
class as far as possible. The classes VMWare.Data.SQLFire.SQLFClientConnection,
VMware.Data.SQLFire.SQLFDataAdapter and VMware.Data.SQLFire.SQLFCommandBuilder require explicit
creation, while the remaining class objects can be obtained using the base classes of the System.Data.Common
namespace.
For example, you need not create the SQLFCommand object explicitly because the
DbConnection.CreateCommand() method provides a base DbCommand object. (This object is actually a
SQLFCommand when it is using a SQLFClientConnection object.) Applications should use the base classes
from the System.Data.Common namespace when writing ADO.NET code that can be easily changed to use a
different driver, or when multiple drivers are used from the same code base.
The table shows the mapping of the SQLFire ADO.NET driver classes to their base classes in the
System.Data.Common namespace that you should use for generic coding. Also listed are the interfaces in
System.Data implemented by the class.
143
Developing ADO.NET Client Applications