Page 1 of 1

Why a grid bound to a TMSQuery refreshed periodically?

Posted: Mon 13 Jan 2014 09:28
by brace
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?

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

Posted: Mon 13 Jan 2014 11:29
by AlexP
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

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

Posted: Mon 13 Jan 2014 11:50
by brace
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?

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

Posted: Mon 13 Jan 2014 12:11
by AlexP
Hello,

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

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

Posted: Mon 13 Jan 2014 14:21
by brace
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.

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

Posted: Mon 13 Jan 2014 15:39
by AlexP
Hello,

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