472,145 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

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 1023

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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.