Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2005, 05:16 PM
Registered User
 
Join Date: Mar 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Desperately Need Help with Loop & Display Script

Hello everyone and anyone. I'm new to ASP and this forum. So please bear with me. I had someone help me with this script which works great. It's purpose is to (1) generate times in time given increments and (2) compare these times to data in a particular database field (MSSQL). If any of the generated times match the database data, the matching generated times are not to display. I attempted to tweak it a little to see if I could do this. Here's the code:

<%
Dim varSatOpen
Dim varSatClosed
Dim varSatapptframe
Dim addTime
Dim newTime 'what I added
Dim whatTime 'what I added

dim dt() : redim dt(-1)

varSatOpen = ("08:00:00")
varSatClosed = ("17:00:00")
varSatapptframe = "30"
addTime = dateadd("h",cint("0"),varSatOpen)
response.write addtime
newTime = ("09:00:00") 'what I've added
whatTime = dateadd("h",cint("0"),newTime) 'what I've added

Do While addTime < dateadd("h",cint("0"),varSatclosed)
addTime = DateAdd("n",cint(varSatapptframe),addTime)
redim preserve dt(ubound(dt)+1)
dt(ubound(dt))=addTime
If whatTime <> dt(ubound(dt)) Then 'what I've added
response.write replace(string(1," ")," ","<br/>") & dt(ubound(dt)) 'from original script
End If 'what I've added
Loop
%>

It works fine until the variable "newTime" is changed to times such as "08:00:00", "08:30:00", or "14:30:00". These times continue to display when they shouldn't. Any ideas what I've done wrong?

Again, any and all help is greatly appreciated.

 
Old March 25th, 2005, 05:45 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

I am sorry, but I do not understand the problem fully. Is it that when you change "newTime" to 08:30:00, it starts displaying from 08:00:00 onwards ? If that is the case, it must be because of cache.

You can prevent pages from going to cache using following code at the very top of the page.

Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-control","no-cache,must revalidate"
Response.Expires =-1
 
Old March 28th, 2005, 07:56 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

pupadu

Yes I remember assisting you - why wouldnt you continue the same post?


Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some help desperately! Deeps Other Programming Languages 0 August 30th, 2007 09:58 AM
Browser Detect & Display DIV Script Sean1989 HTML Code Clinic 2 September 1st, 2006 08:18 AM
display script - zip file - something is wrong? jstewie Javascript How-To 1 August 31st, 2005 02:07 AM
VBA Script to search fields and display contents Jwill1014 Access VBA 8 June 2nd, 2005 07:33 AM
display different color in loop mateenmohd Classic ASP Basics 2 June 16th, 2004 06:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.