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,
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.
转自:http://forums.devart.com/viewtopic.php?t=9537
http://forums.devart.com/viewtopic.php?f=6&t=29879&p=102475&hilit=Update+failed+Found#p102475
http://forums.devart.com/viewtopic.php?f=6&t=9606
如果把StrictUpdate设置为true;更新的数据如果大于一行,或者没有数据更新的话,就会报以下的类似的信息: Update failed. Found 6 records。但是数据库的数据此时已经更新了。