有什么方法可以找出哪个 TField 正在引发 EDBClient 并显示消息“需要字段值”。
我有一个包含多个字段的 TClientDataSet,我收到此异常,我确信我忘记设置一个字段值,但问题是,哪个字段?
有什么方法可以快速找出哪个字段引发了此异常?
编辑
我解决了问题,我将 TClientDataSet 连接到错误的提供程序,该提供程序在服务器上有一个必填字段,但在客户端上没有此字段。
但它仍然不会使我的问题无效,我花了很多时间来弄清楚,如果我有某种方法知道哪个服务器端必填字段引发了此错误,那么我很快就会意识到我的错误是什么。
编辑2
相关QC:
#5557 - 解决为“按设计”。
#54380 - 打开
I have one TClientDataSet with several Fields and I'm getting this exception, I'm sure that I forgot to set one field value, but the question is, which Field?
Is there some way to find out quickly which field is raising this exception?
EDIT
I solved the problem, I was connecting the TClientDataSet to the wrong provider, which had a required field on the server but didn't have this field on the client.
But it still doesn't invalidate my question, I lost a lot of time to figure it out, and if I had some way to know which server side required field was raising this error it would be very quick to realise what was my mistake.
EDIT 2
Related QCs:
#5557 - Solved as "As Designed".
#54380 - Open
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当调试器通知您异常时,请查看调用堆栈。 导航到正在迭代字段列表的例程,并检查此时的循环控制变量,以了解程序在引发异常之前已遍历字段列表多远。
如果循环控制变量不准确,则在该例程中设置断点并重新运行程序。 逐步执行,直到再次出现异常。
另一种选择是查看所有字段并亲自查看哪个字段缺少值。
When the debugger notifies you of the exception, look at the call stack. Navigate to the routine that is iterating over the list of fields, and inspect the loop-control variable at that point to find out how far through the field list your program got before raising an exception.
If the loop-control variable isn't accurate, then set a breakpoint in that routine and re-run your program. Step through until you get the exception again.
Another option is to look at all the fields and see for yourself which one lacks a value.