Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic 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, 01:01 AM
Registered User
 
Join Date: Mar 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to Capture While...Wend Results

Hello everyone and anyone. I'm new to ASP and this is my second time using this forum. So please bear with me. Thanks to mat41 who helped me put this loop together, I have a While...Wend loop that lists times in 30 minute increments. I plan to use this loop in various places in my application. I need to take the results of the loop and compare one of the times to data in a particultar database field (MSSQL). My hope is if the loop result time is the same as the data in the particular database field, then that loop result time should not display on the web page.

Here is the code for the loop that works properly:

<%
Dim strSatOpen
Dim strSatClosed
Dim strSatapptframe
Dim addTime

strSatOpen = ("08:00:00")
strSatClosed = ("17:00:00")
strSatapptframe = "30"
addTime = dateadd("H","0",strSatOpen)
response.write addtime

While addTime < dateadd("H","0",strSatclosed)
addTime = DateAdd("n",strSatapptframe,addTime)
Response.Write "<br>" & addTime
Wend
%>

I need to know how I can capture these loop results and use them on other pages in my application. I've tried the following just to test out my theory:

<%
Dim strSatOpen
Dim strSatClosed
Dim strSatapptframe
Dim addTime

strSatOpen = ("08:00:00")
strSatClosed = ("17:00:00")
strSatapptframe = "30"
addTime = dateadd("H","0",strSatOpen)
response.write addtime
strAvailTime = ("08:30:00") 'this is just a example of assigned data in a database field

While addTime < dateadd("H","0",strSatclosed)
addTime = DateAdd("n",strSatapptframe,addTime)
Response.Write "<br>" & addTime
If addTime <> strAvailTime Then
Response.Write "<br>" & addTime
End If
Wend
%>

All this does is print each time twice. Any and all help is and will be greatly appreciated. :)

 
Old March 20th, 2005, 06:57 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

You are welcome. I seem to remember some cDate functions in the example I gave you(http://p2p.wrox.com/topic.asp?TOPIC_ID=28101), did you drop them for a reason?

cDate, Trim etc functions are available to us for very good reasons. When comparing strings if they pysically look the same, use these functions to force the data type and format you know you are looking for.
------------------------------
While addTime < dateadd("H","0",strSatclosed)
addTime = DateAdd("n",strSatapptframe,addTime)
Response.Write addTime & "<br>"
If trim(cDate(addTime)) <> trim(cDate(strAvailTime)) Then
     Response.Write addTime & " [is not equal to]<br>"
else
     Response.Write addTime & " [is equal to]<br>"
end if
Wend
-------------------------------------

;;;I need to know how I can capture these loop results and use them on other pages in my application.
I would post the in hidden form fields

;;;All this does is print each time twice
Well that is what you have asked the loop to do. The loop should print each time twice except for "08:30:00". Change your loop to look like my example above and it will do this.

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
capture URL SKhna ASP.NET 2.0 Basics 1 February 5th, 2008 11:02 AM
capture images using webcam hulk4141 VB How-To 0 October 11th, 2007 01:34 PM
Edit Query Results in Results Grid druid2112 SQL Server 2005 1 June 28th, 2007 08:49 AM
Which event(s) should be used to capture changes lxu Access 2 April 14th, 2004 09:14 AM





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