Synchronizing Changes Back to the Data Source
The following example shows the application flow for updating a DataSet using Oracle’s Rowid as the update mechanism:
// Create the DataAdapter and DataSets
OpenAccessCommand DbCmd = new OpenAccessCommand
("SELECT rowid, deptid, deptname FROM department", DBConn);
myDataAdapter = new OpenAccessDataAdapter();
myDataAdapter.SelectCommand = DBCmd;
myDataAdapter.Fill(myDataSet, "Departments");
// Build the Update rules
// Specify how to update data in the data set
myDataAdapter.UpdateCommand = new
OpenAccessCommand("Update department set deptname = ? ", deptid = ? " +
"WHERE rowid =?", DBConn);
// Bind parameters
myDataAdapter.UpdateCommand.Parameters.Add
("param1", OpenAccessDbType.VarChar,100,"deptname");
myDataAdapter.UpdateCommand.Parameters.Add("param2",
OpenAccessDbType.Number,4,"deptid";
myDataAdapter.UpdateCommand.Parameters.Add("param3",
OpenAccessDbType.Number,4,"rowid");
In this example, performance of the queries on the Oracle server improves because the WHERE clause includes only the rowid as a search condition.