469,651 Members | 1,672 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,651 developers. It's quick & easy.

Works on one page, but not the other?!

4
I've been assigned a bugfix where a particular bit of script that selects the appropriate connection has suddenly started to fail:

if formatdatetime(dateStr, 1) = formatdatetime(now(), 1) then
With cn
.ConnectionString= ShapeConnection
.CommandTimeout = .ConnectionTimeout
.Open
End With
elseif formatdatetime(dateStr, 1) < formatdatetime(now(), 1) then
With cn
.ConnectionString = Apollo2ShapeConnection
.CommandTimeout = .ConnectionTimeout
.Open
End With
end if

where dateStr is a date selected by the user in a dd-mm-yyyy format. The comparison is failing in both cases and so no connection is being selected. I've changed the code to the following and now it works fine:

if cdate(dateStr) = cdate(now()) then
With cn
.ConnectionString= ShapeConnection
.CommandTimeout = .ConnectionTimeout
.Open
End With
elseif cdate(dateStr) < cdate(now()) then
With cn
.ConnectionString = Apollo2ShapeConnection
.CommandTimeout = .ConnectionTimeout
.Open
End With
end if

It does work now so I'm happy enough with that. What I really dont understand is the original bit of script is used in quite a few pages, and in all these other pages it still works fine. All the pages are on the server and all recieve the dateStr variable in the same format. I've passed the same date into both pages, in one case it fails, in the other it works. WHY?!?

Any ideas about this would be greatly appreciated! It is severely messing with my head!

Cheers :)
Sep 1 '06 #1
0 997

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Guadala Harry | last post: by
6 posts views Thread by patrick j | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.