Updating Row Data

You can use GFXDCommandBuilder to update, delete, and insert rows that are stored in a GFXDDataAdapter object.

The following example uses an GFXDDataAdapter object to store the contents of a table, and then update row data.
string gfxdHost = "localhost";
int gfxdPort = 1527;
string connectionStr = string.Format(@"server={0}:{1}", gfxdHost, gfxdPort);

GFXDClientConnection connection = null;

try
{
    connection = new GFXDClientConnection(connectionStr);

    GFXDCommand command = connection.CreateCommand();
    command.CommandType = CommandType.Text;
    command.CommandText = @"SELECT unit_cost, retail_price
                           FROM product WHERE product_id=<id>";

    connection.Open();

    // Create adapter and populate the DataTable object
    GFXDDataAdapter adapter = command.CreateDataAdapter();
    DataTable table = new DataTable("product");
    adapter.Fill(table);

    // Generate update command
    GFXDCommandBuilder builder = new GFXDCommandBuilder(adapter);
    adapter.UpdateCommand = builder.GetUpdateCommand();

    // Modify product pricing
    table.Rows[0]["unit_cost"] = 99.99;
    table.Rows[0]["retail_price"] = 199.99;

    // Update the underlying table
    adapter.Update(table);
}
catch (Exception e)
{
    ///
    /// Log or re-throw exception
    /// 
}
finally
{
    connection.Close();
}