Why a grid bound to a TMSQuery refreshed periodically?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

Why a grid bound to a TMSQuery refreshed periodically?

Post by brace » Mon 13 Jan 2014 09:28

I noticed a nice behavior in my application. I have a devexpress quantum grid (somehow a powerful TDBGrid), it is linked with a TDataSource to a TMSQuery.

I try to make an example.

Imagine the TMSQuery is a SELECT * FROM CUSTOMERS.

Once the query is opened I see all the customers in the grid (Form A).

Now if from a customer detail form (Form B)i change a value (like "Devartz" to "Devart") after some seconds (usually 30-60, i cannot tell exactly how many) i see that the grid in Form A is updated ("Devartz" to "Devart").

Could you please help me in understanding how this works?

I suspect (but I am not sure) that TMSQuery every X seconds notifies all DataSources that some data has changed.

May be i am wrong, but for sure there is a reason, could you please help me in finding it?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Why a grid bound to a TMSQuery refreshed periodically?

Post by AlexP » Mon 13 Jan 2014 11:29

Hello,

Such behaviour can be possible only in three cases:
1) The AutoRefresh option of the DataSet is enabled - in this case, automatic refresh will occur in a time interval specified in the AutoRefreshInterval property.
2) The TMSChangeNotification component is used, and DataSet is subscribed for events on this table editing.
3) DataSet refresh is called explicitly

brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

Re: Why a grid bound to a TMSQuery refreshed periodically?

Post by brace » Mon 13 Jan 2014 11:50

Thank you.

In fact i found Options.AutoRefresh = True

only on one TMSQuery.

Could you please eplain me how it works internally? Is the TMSQuery.SQL executed again every autorefreshinterval seconds?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Why a grid bound to a TMSQuery refreshed periodically?

Post by AlexP » Mon 13 Jan 2014 12:11

Hello,

You can find detailed information about the autorefresh property functioning in the help: http://www.devart.com/sdac/docs/devart_ ... efresh.htm

brace
Posts: 213
Joined: Wed 14 Feb 2007 08:26

Re: Why a grid bound to a TMSQuery refreshed periodically?

Post by brace » Mon 13 Jan 2014 14:21

Thank you, i realize from here

http://www.devart.com/sdac/docs/index.h ... efresh.htm

that Refresh retrieves all the data.

Thanks for support.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Why a grid bound to a TMSQuery refreshed periodically?

Post by AlexP » Mon 13 Jan 2014 15:39

Hello,

Yes, the Refresh method rereads all the data, in contrast to the RefreshQuick method.

Post Reply