如何将 TField 声明为可为空?
我正在设置一个基于 ADO 的客户端数据集,当我尝试将 null 值插入 TIntegerField 时,在 Post 上我收到 Project 引发的异常类 EDatabaseError ,并显示消息“不可为空的列无法更新为 Null” .
我知道我以前见过一种将 TField 设置为可为空的方法,但我不记得在哪里或如何设置。 有谁知道如何解决这一问题?
编辑:该字段在设计时设置为Required = false,并且我已经验证它在运行时仍然为假,但我仍然收到错误。
I'm setting up an ADO-based client dataset, and when I try to insert a null value into a TIntegerField, on Post I get Project raised exception class EDatabaseError with message 'Non-nullable column cannot be updated to Null'.
I know I've seen a way to set a TField as nullable before, but I can't remember where or how. Does anyone know how to fix this?
EDIT: The field is set to Required = false at design time, and I've verified that it's still false at runtime, but I still get the error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否验证过该字段代表的 db 字段
有非空约束吗?
Have you verified if the db field which this field represents
have a not null constraint?
从帮助到 Delphi 5:
但要注意:
从 TDataSet 继承的类的一些实现可能会自行添加一些逻辑...
From help to Delphi 5:
but be aware of:
Also some implementation of classes inherited from TDataSet may add some logic on their own...
我不知道这是否有帮助,但这听起来很熟悉。 检查提供 cd 的 ado 数据集字段的属性。 我知道在 d7 中,cd 在内部采用提供者数据集的只读属性,无论其自己的只读设置如何。 同样的问题可能适用于所需的属性。
i don't know if this will help but it sounds familiar. check the properties on the fields of the ado dataset that feeds the cds. i know in d7 the cds internally takes on the readonly property of the provider's dataset regardless of its own readonly setting. the same problem may apply to the required property.