Subject | Re: [firebird-support] Noobie Null Date and Time woes |
---|---|
Author | Aage Johansen |
Post date | 2005-12-13T21:11:44Z |
sbdlinxg wrote:
insert into MYTABLE (MYDATE) values (:MYDATE)
and set the parameter to the date value (with no conversion or formatting)
- which makes it independent of the format of a "date string".
If this is not possible in VB (I've never used it), you might get away with
an explicit test in your program (pseudocode):
if date is Null then
insert into MYTABLE (MYDATE) values (Null)
else
insert into MYTABLE (MYDATE) values (yourdatestring)
--
Aage J.
> I've just discovered Firebird and I'm using VB to experiment with it.The usual way is to use a parameterised query:
> This code works fine
>
> myDate = Format(Now(), "mm/dd/yy hh:mm")
> sql = "INSERT INTO MYTABLE (MYDATE) VALUES ('" & myDate & "');"
>
> as long as myDate is a date. If I set myDate = NULL the statement
> causes an error and I know why the error is occurring.
> What I need to know is how to write this statement to take into
> account the possibility that myDate is NULL.
insert into MYTABLE (MYDATE) values (:MYDATE)
and set the parameter to the date value (with no conversion or formatting)
- which makes it independent of the format of a "date string".
If this is not possible in VB (I've never used it), you might get away with
an explicit test in your program (pseudocode):
if date is Null then
insert into MYTABLE (MYDATE) values (Null)
else
insert into MYTABLE (MYDATE) values (yourdatestring)
--
Aage J.