Board index » delphi » CachedUpdates=True and RequestLive=True possible for a query?

CachedUpdates=True and RequestLive=True possible for a query?

I would like to set CachedUpdates=True for a query so that inserted
records remain visible in the grid connected to the query.  Can I set
RequestLive=True at the same time?  If so, do I need to specify an
UpdateSQL object for the query.

In other words, can I set CachedUpdates=True and RequestLive=True and
then do the following without an UpdateSQL object:

query.edit;
change field values
query.ApplyUpdates;
query.CommitUpdates;

or

query.insert;
set field values
query.ApplyUpdates;
query.CommitUpdates;

Mark Huebner
mkhueb...@sprynet.com

 

Re:CachedUpdates=True and RequestLive=True possible for a query?


From my experience - it is not possible. You should
better use CachedUpdates and TUpdateSQL - it
is not as hard as it looks like.

Valentin Naoumov
vnau...@yahoo.com

Re:CachedUpdates=True and RequestLive=True possible for a query?


The weird thing is that the program seems to work with no UpdateSQL
component for this query and inserted records remain visible in the
grid for that table.  But maybe I should avoid this since it's not a
documented feature - or is it documented somewhere?  Unfortunately, I
can't get the ApplyUpdates to insert new records using an UpdateSQL
component (see previous posting).

Query.CachedUpdates=True
Query.LiveRequest=True

Query.Edit
<change field values>
Query.ApplyUpdates

or

Query.Insert
<assign values to fields>
Query.ApplyUpdates

Re:CachedUpdates=True and RequestLive=True possible for a query?


Mark,

You really should use CachedUpdates=True and RequestLive=False, and use
a TUpdateSQL as UpdateObject.  Also use a TDatabase component, and
transactions.  When it comes time to apply your updates, do so like

Database1.StartTransaction;
try
  Query1.ApplyUpdates;
  Database1.Commit;
except
  Database1.Rollback;
end;
Query1.CommitUpdates;

HTH,
Jim

Re:CachedUpdates=True and RequestLive=True possible for a query?


Thanks for your reply Jim.  I actually am doing it exactly as you
indicated.  I just didn't want to put too much code in my example.
Also, I solved my problem with the error "value too large for column"
so my ApplyUpdates is now working without RequestLive=True.

Mark Huebner
mkhueb...@sprynet.com

Other Threads