Query - DataChange notification too often when opening

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
crafty
Posts: 15
Joined: Thu 30 Aug 2007 15:34

Query - DataChange notification too often when opening

Post by crafty » Sun 06 Apr 2008 22:51

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

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Mon 07 Apr 2008 12:20

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.

crafty
Posts: 15
Joined: Thu 30 Aug 2007 15:34

Post by crafty » Mon 07 Apr 2008 13:46

Hello Antaeus,

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

Regards

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 09 Apr 2008 11:17

We are investigating this problem. Meanwhile you should use this solution in your applications.

Post Reply