DbExpress "Record not found or modified by another user"

How to find the cause of the "Record not found or changed by another user" error when working with dbExpress?

How can I find a SQL statement (with actual parameter values) that fails?

+3
source share
1 answer
  • make sure the compiler uses debug DCU.

  • set a breakpoint in the first line of the TSQLResolver.DoExecSQL procedure in the db\Provider block

  • run an operation that causes an error message (for example, changing a record in a component that supports data)

  • if the debugger is stopped, you can view the created SQL command

  • check SQL statement for conditions that may cause an error

At this point, only constant expressions in an expression of the type ... 'can be checked, where Field1 is zero and Field2 = 0'. in DoExecSQL, the SQL statement uses placeholders (?) for parameter values, so if the conditions of the constant expression do not show anything useful, continue debugging:

  • to see the actual parameter values, set a breakpoint in the TSQLConnection.Execute function (in the SqlExpr block) and go through the parameter evaluation cycle.
+4
source

Source: https://habr.com/ru/post/913023/


All Articles