Page 1 of 1
Direct Grid Update How To Do It
Posted: Thu 10 Apr 2008 15:46
by gohjoe
How to do a direct grid update? I place a dbgrid on a form, connecting to a MyQuery1 or MyTable1? I next place a save button. What is the simplest way to update the changes I make in the grid to the data? What are the commands neccesary to make this happen. My current tries result in O records found - failed.
I used the following:
MyQuery.CachUpdate := True;
MyQuery.ApplyUpdates;
MyQuery.CommitUpdates;
Pls Advise
Blurr NewBie

Posted: Fri 11 Apr 2008 12:37
by Dimon
You should set the CachedUpdates property to True before making any changes.
After changing data call
Code: Select all
MyQuery.ApplyUpdates;
MyQuery.CommitUpdates;
to save the changes to the database.
Not Working!
Posted: Mon 14 Apr 2008 12:48
by gohjoe
Yap! I did that. But the message came out that "0 record found. Update Failed". I turned of StrictUpdate to False to prevent this message but on refresh, the previous data return. I know you have written on this in FAQ but only solution to LIVE UPDATE has not been given. In Access, I believe there is a REQUESTLIVE option. Is it possible in Delphi with MyDac. Is there a shorter example than the included example? This question has been raised before in this forum, but I have yet to locate an adequate solution. Can you help?
Posted: Tue 15 Apr 2008 07:15
by Dimon
For these records to be changed correctly, there should be key fields in the table.
You can see how to work with CachedUpdates in the CachedUpdates demo of MyDacDemo.