Question

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.

Was it helpful?

Solution

Have you verified if the db field which this field represents have a not null constraint?

OTHER TIPS

MyField.Required := False;

From help to Delphi 5:

property Required: Boolean;

but be aware of:

property CustomConstraint: String;

Also some implementation of classes inherited from TDataSet may add some logic on their own...

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top