TMSQuery not updating the first time

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
GuyB
Posts: 3
Joined: Wed 26 Nov 2008 04:56

TMSQuery not updating the first time

Post by GuyB » Wed 26 Nov 2008 05:19

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!!!!!!!!!!

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 26 Nov 2008 12:30

Please check if the TMSQuery.CursorType property is set to ctDefaultResultSet.

GuyB
Posts: 3
Joined: Wed 26 Nov 2008 04:56

Post by GuyB » Thu 27 Nov 2008 02:30

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

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 27 Nov 2008 08:37

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.

Post Reply