Page 1 of 1

Query - DataChange notification too often when opening

Posted: Sun 06 Apr 2008 22:51
by crafty
Hello,

I've recently encountered a problem with using SDAC (and MyDAC). If I connect a grid control to the Query (via DataSource) I get the OnFocusedRowChanged event (in grid) fired 3 times after I use Query.Open().
I've found out that other DataSet components that I use don't produce this problem so it is related to SDAC. This can be easily reproduced by testing TDataSource.OnDataChange and TDataSource.OnStateChange.

TMsQuery.Open() fires:

Code: Select all

TDataSource.OnDataChange
TDataSource.OnStateChange
TDataSource.OnDataChange
TDataSource.OnDataChange
TDataSource.OnDataChange
DataSet.Open() should fire:

Code: Select all

TDataSource.OnDataChange
TDataSource.OnStateChange
TDataSource.OnDataChange
I'm not sure, but I think that this problem wasn't always present in SDAC. Please check this because I'm doing intensive calculations when the selected record changes and right now they are done 3 times instead of once.

Best regards,
Crafty

Posted: Mon 07 Apr 2008 12:20
by Antaeus
Please, set the SendDataSetChangeEventAfterOpen global variable to False before opening a TMSQuery, and inform whether this fixed the behaviour.
This variable is declared in the MemDS unit.

Posted: Mon 07 Apr 2008 13:46
by crafty
Hello Antaeus,

Yes, with this option I get the normal behaviour (one call to OnFocusedRowChanged). Is this a temporary solution?

Regards

Posted: Wed 09 Apr 2008 11:17
by Antaeus
We are investigating this problem. Meanwhile you should use this solution in your applications.