Insert data with Null value instead of default value
Posted: Tue 13 May 2014 14:14
Hello,
Using Delphi7 with SDAC 6.9.17
Recently we've noticed some change in behavior between SDAC & DBExpress
We have a table and a field with decimal(28,9) type & default 0 value & allow null values
when we create a new row for this table with the SDAC components and we set the value of the field to be Null
for example:
DataSet.FieldByName('field1').Value := Null;
or
DataSet.FieldByName('field1').Clear();
in both cases after the Dataset.Post() action the field is being ignored in the insert query which is incorrect because we've set the value to be Null
this results with a new row being inserted with the default value which is 0 and not Null as it was intended
this behavior works fine when we are using the DBExpress components
we've also noticed that in DBExpress the field's new value property is set to unassigned and when we set it to Null it is included in the insert query as it should.
Thanks,
Using Delphi7 with SDAC 6.9.17
Recently we've noticed some change in behavior between SDAC & DBExpress
We have a table and a field with decimal(28,9) type & default 0 value & allow null values
when we create a new row for this table with the SDAC components and we set the value of the field to be Null
for example:
DataSet.FieldByName('field1').Value := Null;
or
DataSet.FieldByName('field1').Clear();
in both cases after the Dataset.Post() action the field is being ignored in the insert query which is incorrect because we've set the value to be Null
this results with a new row being inserted with the default value which is 0 and not Null as it was intended
this behavior works fine when we are using the DBExpress components
we've also noticed that in DBExpress the field's new value property is set to unassigned and when we set it to Null it is included in the insert query as it should.
Thanks,