Page 1 of 1

SDAC Default or NULL

Posted: Sun 27 Apr 2008 22:13
by PerW
Hi
I use Cbuilder 2006 and latest SDAC 4.35.1.16 and MSSQL 2005
I have some money field with default value (0). A do some calculation so I can't have values of NULL.
But if a delete all values and send 'NULL' from the program MSSQL acept this and update the table with NULL value even default is (0).
I don't now if this is a MSSQL error or SDAC error.
For me it makes no sens to be able to update a column with NULL when deafault value is (0).

Posted: Tue 29 Apr 2008 09:08
by Antaeus
Try to use the default keyword in your queries instead of NULL:

INSERT INTO tb_default_test (c_default) VALUES(default)

If you perform the changes editing a dataset but not executing queries directly, you should write a code like this in the BeforeUpdateExecute event handler of your dataset:

Code: Select all

var
  Param: TParam;
begin
  Param := Params.FindParam('c_default');
  if (Param  nil) and Param.IsNull then
    Param.Bound := False;