Page 1 of 1

TMSQuery not updating the first time

Posted: Wed 26 Nov 2008 05:19
by GuyB
I am using SDAC 4.50.0.36 with Delphi 2007.

I am converting an application from BDE to SDAC and one particular form i am working on has 10 TMSQuery components updating different fields.

While testing i noticed that when i update one of the tables that the value is not retained in the database until i hit the save button a second time.
I have checked the values in the beforepost and they hold the correct values but after the beforepost has executed nothing has changed.

I use the insert, update and delete sql properties at design time and turn on cacheupdates.
I have tried using post, applyupdates and commitupdates and no difference is noticed.

HELP!!!!!!!!!!

Posted: Wed 26 Nov 2008 12:30
by Dimon
Please check if the TMSQuery.CursorType property is set to ctDefaultResultSet.

Posted: Thu 27 Nov 2008 02:30
by GuyB
Thanks for the prompt reply.

I will try this out and let you know. What i wanted to ask is how will this change affect the other TMSQuery components on the form. As i mentioned in my initial post that this form is a complicated form which gives the user a comprehensive view across several tables and off course they can and will update from all the result sets.

regards

Guy

Posted: Thu 27 Nov 2008 08:37
by Dimon
You should call the TDataSet.Refresh method when you want to get up-to-date information. Also you can set the AutoRefresh option to True to automatically refresh a dataset every AutoRefreshInterval seconds.
You can find more detailed information about this in the SDAC help. Also you can look through the example of using these methods in the SDACDemo.