Subject | Re: [firebird-support] Noobie Null Date and Time woes |
---|---|
Author | Lin XG |
Post date | 2005-12-14T19:41:40Z |
Thanks for the help everyone;
Problem solved. Here's how it worked out.
myDate = Format(Now(), "mm/dd/yy hh:mm")
If IsDate(myDate) = True Then
myDate = "'" & myDate & "'"
Else
myDate = "NULL"
End If
sql = "INSERT INTO MYTABLE (MYDATE) VALUES (" & myDate
& ");"
Thanks again for the help and discussion. I'm sure
you'll hear lots more from me as I continue to learn
more about Firebird
--- Jason Dodson <jasond@...> wrote:
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Problem solved. Here's how it worked out.
myDate = Format(Now(), "mm/dd/yy hh:mm")
If IsDate(myDate) = True Then
myDate = "'" & myDate & "'"
Else
myDate = "NULL"
End If
sql = "INSERT INTO MYTABLE (MYDATE) VALUES (" & myDate
& ");"
Thanks again for the help and discussion. I'm sure
you'll hear lots more from me as I continue to learn
more about Firebird
--- Jason Dodson <jasond@...> wrote:
> Is MyDate a Variant?++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Anyway, set MyDate = "NULL", quotes and all. The SQL
> will work fine as long as
> MyDate holds the STRING "NULL", not a NULL value.
>
> Jason
>
> sbdlinxg wrote:
> > I've just discovered Firebird and I'm using VB to
> experiment with it.
> > 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.
> >
> > Thanks
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > Visit http://firebird.sourceforge.net and click
> the Resources item
> > on the main (top) menu. Try Knowledgebase and FAQ
> links !
> >
> > Also search the knowledgebases at
> http://www.ibphoenix.com
> >
> >
>
> >__________________________________________________
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
>
> The information transmitted herewith is sensitive
> information intended only for use to the individual
> or entity to which it is addressed. If the reader
> of this message is not the intended recipient, you
> are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use
> of, or taking of any action in reliance upon, this
> information is strictly prohibited. If you have
> received this communication in error, please contact
> the sender and delete the material from your
> computer.
>
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com