For a while in the late 90's we had in house a running joke that functions called Refresh never did anything, based on the fact that TDataset.Refresh and a few others (perhaps TWinControl.Refresh?) never actually solved the problem you were trying to solve when you called them. ;-)
I think things have moved on a bit since then but I still suspect Refresh is the wrong method in this instance and Close followed by Open is necessary as Alister suggests. Cheers, David. From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On Behalf Of Alister Christie Sent: Friday, 14 January 2011 3:24 p.m. To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] Sql query Rather than doing a Refresh you could do an Open and a Close. If you do this you probably want to store what record you are on id := QToDo.FieldByName(id).AsInteger; QToDo.Close; QToDo.Open QToDo.Locate('id', id, []); substituting id for whatever your primary key is. Not elegant but better than restarting the application. Alister Christie Computers for People Ph: 04 471 1849 Fax: 04 471 1266 http://www.salespartner.co.nz PO Box 13085 Johnsonville Wellington On 14/01/2011 12:49 p.m., Marshland Engineering wrote: I'm viewing a SQL query in a dbgrid. When I add a record to the source db and I run QToDo.Refresh it does not include the new record in the dbgrid. If I close the application and re-run it, the record is displayed. Is refresh the correct property or is there something else. Thanks Wallace _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe