Ask a Question related to ASP Database, Design and Development.
-
Exception error with date/time (Access 2000)
I am picking up a strange exception error for the following statement:
If Rs.EOF OR DATEDIFF("d",rs("DateTime"),NOW()) Then
'//
End If
Is there something wrong with my function
Guest
-
Date/Time format with MS Access & CF
Does anyone know of any workarounds regarding date/time format between MS Access and ColdFusion? Right now I have to set a column in my Access... -
MS Access time and date problem
As the topic summary says, I am having trouble inserting both time and dates into a MS Access database. My database has three fields, eventdate,... -
date/time field from access 2000 db getting -1 in textbox on form
I am stuck in using Access 2000 with on Windows 2000 server. I get a negitive 1 for a value. My code $DB_Conn = new... -
ASP SQL Server 2000 Date/Time Formating
Hello, I have two questions which I would appreciate some help with. 1. Date Formating when Inserting into SQL Server 2000 I'm currently... -
Convert date/time to date in SQL Server 2000 statement
Can this be done? tia -
Bob Barrows [MVP] #2
Re: Exception error with date/time (Access 2000)
[email]jason@catamaranco.com[/email] wrote:
Two things:> I am picking up a strange exception error for the following statement:
>
> If Rs.EOF OR DATEDIFF("d",rs("DateTime"),NOW()) Then
> '//
> End If
>
> Is there something wrong with my function
1. Datediff returns a number, not a boolean. While it won't cause an error,
it's more correct (and less confusing) to use
DATEDIFF("d",rs("DateTime"),NOW()) = 0
2. vbscript does not do short-circuit (lazy) evaluation. Both boolean
operands will be evaluated. If EOF is true, then the datediff will throw an
error. You have to nest them:
if not rs.eof then
if DATEDIFF("d",rs("DateTime"),NOW()) = 0 then
end if
else
end if
[url]http://blogs.msdn.com/ericlippert/archive/2004/07/15/184431.aspx[/url]
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows [MVP] Guest
-
Re: Exception error with date/time (Access 2000)
Thanks Bob....testing as we speak and also reading that cool blog along the
way!
- Jason
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:%23zHADdPeEHA.3680@TK2MSFTNGP11.phx.gbl...error,> [email]jason@catamaranco.com[/email] wrote:> Two things:> > I am picking up a strange exception error for the following statement:
> >
> > If Rs.EOF OR DATEDIFF("d",rs("DateTime"),NOW()) Then
> > '//
> > End If
> >
> > Is there something wrong with my function
> 1. Datediff returns a number, not a boolean. While it won't cause anan> it's more correct (and less confusing) to use
> DATEDIFF("d",rs("DateTime"),NOW()) = 0
>
> 2. vbscript does not do short-circuit (lazy) evaluation. Both boolean
> operands will be evaluated. If EOF is true, then the datediff will throw> error. You have to nest them:
>
> if not rs.eof then
> if DATEDIFF("d",rs("DateTime"),NOW()) = 0 then
> end if
> else
> end if
>
> [url]http://blogs.msdn.com/ericlippert/archive/2004/07/15/184431.aspx[/url]
>
> Bob Barrows
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>
Guest



Reply With Quote

