[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2471
  • Last Modified:

ADOQuery cache update

I use adoquery and dbgrid, I want to handle the record changes by myself when user finish update all rows.

How can I set this adoquery in cache mode like BDE TQuery? So I can process the data row by row.

Thanks.

Jammy
0
jlislo
Asked:
jlislo
  • 2
1 Solution
 
Mohammed NasmanSoftware DeveloperCommented:
Hello

  I think if you change the cursor location to: clUseClient, and CursorType to : ctStatic and the locktype to : ltBatchOptimistic that I think will be as you need

from the Delphi Help:

Opening the dataset in batch update mode
o 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 to the values 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.

with ADODataSet1 do begin

  CursorLocation := clUseServer;
  CursorType := ctKeyset;
  LockType := ltBatchOptimistic;
  CommandType := cmdText;
  CommandText := 'SELECT * FROM Employee';
  Open;
end;

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.

also look at the disconnected recordset
0
 
jlisloAuthor Commented:
Thank you very much! It works great.
0
 
Mohammed NasmanSoftware DeveloperCommented:
you are welcome :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now