Problem with StrictUpdate property of class "TDADataSetOptions" in DBAccess file

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Balaji
Posts: 20
Joined: Thu 05 Oct 2006 04:45

Problem with StrictUpdate property of class "TDADataSetOptions" in DBAccess file

Post by Balaji » Tue 17 Apr 2007 13:15

Hi,

If we see the help for StrictUpdate property of class "TDADataSetOptions" in DBAccess file, it says:

"StrictUpdate TCustomDADataSet raises exception when number of the updated or deleted records does not equal to 1. Setting this option also causes an exception if RefreshRecord procedure returns more than one record. The exception does not occur when you use non-SQL block."

In our application, there is an instance, where on clicking the delete button, all the records displayed in a grid are deleted. In that scenario, the FUpdateQuery.RowsAffected count is greater than 1 and in the following condition of 'PerformSQL' function of the 'DBAcess.pas' file :
------------------------------------------------------------------------------------
" if FOptions.StrictUpdate and
//(Command.SQLType in [SQL_INSERT,SQL_UPDATE,SQL_DELETE]) and /// for ODAC
((FRowsAffected = 0) or (FRowsAffected > 1))
then
DatabaseError(Format(SUpdateFailed, [FRowsAffected])); "
-----------------------------------------------------------------------------------
is giving an error Message.

This is happening because the parameter "StrictUpdate " is set to true in the constructor of class "TDADataSetOptions"
If we change the value to 'false' in the construtor, the error is not raised and application is running fine.

Will setting "StrictUpdate " to false in the constructor can have severe implications on other db operations ?

Please instruct Us regarding the same and any other possible solutions other than this.

Waiting for your clarification on the same,

Regards
Balajee

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Wed 18 Apr 2007 06:44

It is safe to set StrictUpdate to False in constructor.
It won't affect any other database operations except the ones listed in SDAC Help in the description of the StrictUpdate property.

Post Reply