"SELECT ID, CUSTOMERNAME, CREDITLIMIT FROM CUSTOMERS WHERE ID=10"
I put a couple of DB edit boxes on a form and link them to each field in this query. No worries. I can edit save, delete, etc.
But now let us do something (on the same form perhaps) that will update the table CUSTOMERS. Something like
"UPDATE CUSTOMERS SET CREDITLIMIT=0 WHERE ID=10".
Ok. Now we have updated the data that the original UniQuery is pointing to. I can see no way to get this original query to update with the new values that are now in the table. You would think that something like UniQuery.Refresh would do the job. But not on your life..
The ONLY way I have been able to get this to work is do a Close/Open. ie
Now the UniQuery has the correct data and the fields on the form are updated.
The problem with this approach is we need to stay on the same record and doing an Open/Close does not always do that. It does in the above example, but I am usually loading in a lot of customer records and displaying them in a grid.
So I have tried doing this
Code: Select all
B := query.GetBookmark; try query.close; query.open; try query.GotoBookmark(B); except on e: exception do Log(e.Message); end; finally query.FreeBookmark(B); end
This is all done on the same form, connecting through the same UniConnection to a Firebird 3 server.
Is there some secret to getting the UniQuery component to do a refresh? Can I tie into some event or something? I usually only want to refresh the current record - not the whole dataset. I might have popped up a form to do an edit on that one row in a grid, or I run a Exec query like I showed above, updating totals or something.