dbExpress“记录未被另一用户发现或改变”。 [英] dbExpress "Record not found or changed by another user"
问题描述
在使用dbExpress时,如何找到找不到其他用户发现或更改的记录错误的原因?
How do I find the reason for a "Record not found or changed by another user" error when working with dbExpress?
如何查找失败的SQL语句(带有实际参数值)?
How do I find the SQL statement (with the actual parameter values) that fails?
推荐答案
-
确保编译器使用调试DCU。
make sure that the compiler uses Debug DCUs.
在第一个设置断点
dbSQLProvider
运行导致错误消息的操作(例如,修改数据感知组件中的记录)
run the operation which causes the error message (for example, modifying a record in a data-aware component)
如果调试器停止,可以查看生成的SQL命令
if the debugger stops, the generated SQL command can be viewed
检查SQL语句中是否存在可能导致错误的条件
check the SQL statement for conditions which could cause the error
这时,只能检查语句中的常量表达式,例如...'其中Field1为null且Field2 = 0'。在DoExecSQL中,SQL语句使用占位符(?)作为参数值,因此,如果常量表达式条件没有显示出任何帮助,请继续调试:
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:
- 要查看实际参数值,请在函数TSQLConnection.Execute中设置一个断点(在SqlExpr中),并逐步执行参数求值循环。
这篇关于dbExpress“记录未被另一用户发现或改变”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!