Problem with UniDac, CachedUpdates, MS-SQL
Posted: Mon 31 Jan 2011 13:13
Hi i use the following method to update a table
mdQuery : TUniQuery with cachedupdates := true
SQL: select * from table
In a Procedure I do the following:
with mdQuery do begin
StartTransaction;
"ExcuteSQL"('update table set field1 = 'test' where id = 8')
mdQuery.Edit; << ERROR "Record was changed by another user" only with MS-SQL, Oracle and MySQL works fine
mdQuery.FieldByName('field1').AsString := 'test';
mdQuery.Post;
Commit;
end;
I use this Method with cachedupdates to avoid to refresh from Table cause i only change 1 Field in 100.000 Records.
at the end of all modifikations i usually call mdQuery.CancelUpdates.
mdQuery : TUniQuery with cachedupdates := true
SQL: select * from table
In a Procedure I do the following:
with mdQuery do begin
StartTransaction;
"ExcuteSQL"('update table set field1 = 'test' where id = 8')
mdQuery.Edit; << ERROR "Record was changed by another user" only with MS-SQL, Oracle and MySQL works fine
mdQuery.FieldByName('field1').AsString := 'test';
mdQuery.Post;
Commit;
end;
I use this Method with cachedupdates to avoid to refresh from Table cause i only change 1 Field in 100.000 Records.
at the end of all modifikations i usually call mdQuery.CancelUpdates.