How do I find the reason for a "Record not found or changed by another user" error when working with dbExpress?
How do I find the SQL statement (with the actual parameter values) that fails?
How do I find the reason for a "Record not found or changed by another user" error when working with dbExpress?
How do I find the SQL statement (with the actual parameter values) that fails?
make sure that the compiler uses Debug DCUs.
set a breakpoint in the first line of the Procedure TSQLResolver.DoExecSQL
in unit db\Provider
run the operation which causes the error message (for example, modifying a record in a data-aware component)
if the debugger stops, the generated SQL command can be viewed
check the SQL statement for conditions which could cause the error
At this point, only constant expressions in the statement like ... 'where Field1 is null and Field2 = 0' can be checked. in DoExecSQL, the SQL statement uses placeholders (?) for parameter values, so if the constant expression conditions did not show anything helpful, continue debugging: