RAD Studio |  |

Opening the Dataset in Batch Update Mode
See Also
Collapse All

To open an ADO dataset in batch update mode, it must meet these criteria:

1. The component's CursorType property must be ctKeySet (the default property value) or ctStatic.
2. The LockType property must be ltBatchOptimistic.
3. The command must be a SELECT query.

Before activating the dataset component, set the CursorType and LockType properties as indicated above. Assign a SELECT statement to the component's CommandText property (for TADODataSet) or the SQL property (for TADOQuery). For TADOStoredProc components, set the ProcedureName to the name of a stored procedure that returns a result set. These properties can be set at design-time through the Object Inspector or programmatically at runtime. The example below shows the preparation of a TADODataSet component for batch update mode.
Copy Code

    with ADODataSet1 do begin
      CursorLocation := clUseClient;
      CursorType := ctStatic;
      LockType := ltBatchOptimistic;
      CommandType := cmdText;
      CommandText := 'SELECT * FROM Employee';
      Open;
    end;

Copy Code

    ADODataSet1->CursorLocation = clUseClient;
    ADODataSet1->CursorType = ctStatic;
    ADODataSet1->LockType = ltBatchOptimistic;
    ADODataSet1->CommandType = cmdText;
    ADODataSet1->CommandText = "SELECT * FROM Employee";

After a dataset has been opened in batch update mode, all changes to the data are cached rather than applied directly to the base tables.

See Also

Inspecting the Update Status of Individual Rows

Filtering Multiple Rows Based On Update Status

Applying the Batch Updates to Base Tables

Canceling Batch Updates

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!