Board index » delphi » Number of Records doesn't change after posting a new record

Number of Records doesn't change after posting a new record

I use TQuery with SQL: Select * from P_Agenda
It's RequestLive = True
After I post a new record, the last record in dbgrid dissapears. It
means: the number of records doesn't change, unless I close and re-open
it (since using nbRefresh or TQuery.Refresh makes an error).

I don't have this problem when I use TTable. Do you know what's wrong
with it? I think the problem is Refresh procedure.

Thanks in advance.

Regards,
Wasis

 

Re:Number of Records doesn't change after posting a new record


Refresh does not do anything for TQuery's.  You need to open and close by hand
for the query since the work is being done on the server side.  When you insert
an item, the TQuery has no idea if it fits the SQL or not so it does not hold it
locally after it goes to the server.  You need to close / open to get the
current look on the client side.

Quote
Wasis Sugiono wrote:

> I use TQuery with SQL: Select * from P_Agenda
> It's RequestLive = True
> After I post a new record, the last record in dbgrid dissapears. It
> means: the number of records doesn't change, unless I close and re-open
> it (since using nbRefresh or TQuery.Refresh makes an error).

> I don't have this problem when I use TTable. Do you know what's wrong
> with it? I think the problem is Refresh procedure.

> Thanks in advance.

> Regards,
> Wasis

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
The fool escaped from paradise will look over his shoulder and cry
Sit and chew on daffodils and struggle to answer why?
As you grow up and leave the playground
Where you kissed your Prince and found your frog
Remember the jester that showed you tears, the script for tears. (Fish)
--

Other Threads