1.0

Table Of Contents
adapter.Fill(table);
// Generate update command
SQLFCommandBuilder builder = new SQLFCommandBuilder(adapter);
adapter.InsertCommand = builder.GetInsertCommand();
// Create new product row
DataRow row = table.NewRow();
row[0] = <product_id>;
row[1] = <...>;
row[2] = <...>;
...
// Update the underlying table
adapter.Update(table);
}
catch (Exception e)
{
///
/// Log or re-throw exception
///
}
finally
{
connection.Close();
}
Managing SQLFire Transactions
SQLFClientConnection implements methods to help you delimit SQLFire transactions in your application code.
You begin and commit transactions using the connection object itself.
The following example uses an SQLFDataAdapter object to insert and update table data within as a single
transaction.
string sqlfHost = "localhost";
int sqlfPort = 1527;
string connectionStr = string.Format(@"server={0}:{1}", sqlfHost, sqlfPort);
SQLFClientConnection connection = null;
try
{
// Open connection, disable auto-commit, and start transaction
connection = new SQLFClientConnection(connectionStr);
connection.AutoCommit = false;
connection.BeginSQLFTransaction(IsolationLevel.ReadCommitted);
SQLFCommand command = connection.CreateCommand();
command.CommandType = CommandType.Text;
connection.Open();
// Get product info
command.CommandText = "SELECT * FROM product WHERE product_id=?";
SQLFDataAdapter adapter = command.CreateDataAdapter();
DataTable table = new DataTable("product");
adapter.Fill(table);
// Create new order
command.CommandText = "INSERT INTO orders VALUES(?, ?, ?, ?, ?)";
127
Developing ADO.NET Client Applications