问题很简单:我在我的Firebird 2.1.4数据库中触发器和生成器,以在每个插入件上为列自动增量。

系统的架构如下:

TSQLConnection > TSQLDataSet -> TDataSetProvider -> (DataSnap) -> TClientDataSet -> TDataSource
. 但是,如果我尝试用一些缺少的列在我的tclientdataset中发布更新,Delphi将抱怨如下:
Field 'XXX' must have a value
.

如果我使用缺少这些字段的SQL插入语句,则插入行,触发器和生成器按预期工作。

如何制作delphi(dbx,dataSnap等)了解我正在尝试的(并允许它)?

编辑

提供基于@ MJ2008的注释的更多信息:使用CloneCursor方法在运行时创建此TclientDataset。调用CloneCursor后,我将此字段所需属性设置为false。它没有帮助这个问题。示例:

myCds.CloneCursor(otherCds, True);
myCds.FieldByName('XXX').Required := False;
.

这会导致抛出的异常相同。

有帮助吗?

解决方案

I had to set the TSQLDataset's Required property to False too. That solved the issue.

其他提示

Just to complement: when you do a TClientDataset setting, the updates are in the end sent to the data access component, in this case TSQLDataset, so even if the TClientdataset doesn't require the field's value, if the data access component requires it the error is raised.

It'll be the same even if data come from a TADODataset, TIbDataset, or whatever.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top