Page 1 of 1

Date Default values

Posted: Sat 21 Apr 2007 13:31
by NoComprende
If I give a NOT NULL DATE field a DEFAULT value of '9999-12-31' and assign it a NULL value in BCB6 it ends up with a value of '1899-12-30'.

I fare no better in the MySQL Query Browser as after assigning it a NULL value in that it ends up with a value of '0000-00-00'.

Anyone cast any light on this?

Using MySQL 5.0.27
MyDac 5.00.0.1

Posted: Mon 23 Apr 2007 12:54
by Antaeus
Try to use the Clear() method instead of assigning the NULL value:

Code: Select all

MyQuery1->FieldByName("Date_field")->Clear();

Posted: Mon 23 Apr 2007 13:13
by NoComprende
I tried that Antaeus but the result was the same.

Posted: Mon 23 Apr 2007 14:58
by Antaeus
I tested this issue withe following filed definition on the last MyDAC version (5.00.1.6):

Code: Select all

  `HIREDATE` date NOT NULL default '9999-12-31',
and the following code:

Code: Select all

  MyQuery1->Open();
  MyQuery1->Edit();
  MyQuery1->FieldByName("HireDate")->Clear();
  MyQuery1->Post();
I see in the server log that the following command is sent:

Code: Select all

  UPDATE emp
  SET
    HIREDATE = NULL
  WHERE
    EMPNO = 1 
Try to download the last MyDAC. I the problem persists, specify your code, and table definition.