// Get default database
Database database = DatabaseFactory.CreateDatabase();
// Read all the customers in a dataset
string selectSql = "SELECT * FROM Customers";
DataSet customerDataSet = database.
ExecuteDataSet(CommandType.Text, selectSql);
// Modify Records
foreach (DataRow dr in customerDataSet.Tables[0].Rows)
dr["Name"] += "2";
// Create UpdateCommand
string updateSql = "UPDATE Customers SET Name = @Name
WHERE CustomerId = @CustomerId";
DbCommand updateCommand = database.
GetSqlStringCommand(updateSql);
database.AddInParameter(updateCommand, "CustomerId",
DbType.Int32, "CustomerId", DataRowVersion.Current);
database.AddInParameter(updateCommand, "Name",
DbType.String, "Name", DataRowVersion.Current);
// Execute Batch Update
// Use zero to specify database
// maximum batch update size
database.UpdateDataSet(customerDataSet, "Table", null,
updateCommand, null, UpdateBehavior.Transactional, 0);