Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 February 27th, 2005, 03:43 PM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default variable as operator...

Hello.

I've been racking my brains for a few days trying different methods of reaching my goal... "using a variable to store an operator".

The sample below shows using an operator/variable and actually using the operator... the operator/variable does not work?

Here is a very simple version of what I want to achieve:
--------------------------------------------------------
vStartWeekOnWhatDayOriginal = "03/22/2005"
vFollowUp = "02/22/2005"

vTest = "<="

response.write "Variable operator : "&vTest&"<br>"
response.write "<BR>This is the value of follow up:"&vFollowUp
response.write "<BR>This is the value of start week on what day:"&cstr(cdate(vStartWeekOnWhatDayOriginal))
'response.write "<BR>This is the result using VARIABLE operator: "& eval(vFollowUp &cstr(vTest)& cstr(cdate(vStartWeekOnWhatDayOriginal)))&"<BR>"

if vFollowUp & vTest & cdate(vStartWeekOnWhatDayOriginal) then
response.write "Inside if This is the result using actulal operator: "&eval(vFollowUp >= cstr(cdate(vStartWeekOnWhatDayOriginal)))&"<BR>"
end if

if vFollowUp <= cstr(cdate(vStartWeekOnWhatDayOriginal)) then
response.write "<BR>Inside if___This is the result using actulal operator: "&eval(vFollowUp >= cstr(cdate(vStartWeekOnWhatDayOriginal)))&"<BR>"
end if
--------------------------------------------------------

As you can see, I've tried using the "eval()" function as well, I've tried using a case select statements... it seems to be a little something I can't figure out right now.

In the end I'm going to use the operator/variable in a while loop:
--------------------------------------------------------
While eval(cstr(vFollowUp) & cstr(vTest )& cstr(cDate(vStartWeekOnWhatDay))) and not oRS.EOF and not oRS.BOF
--------------------------------------------------------

As you can see, I've been trying multiple routes.

Thanks very much for any help that comes my way.

 
Old March 1st, 2005, 07:14 PM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

O.k. since there doesn't seem to be an answer kicking around...

I'll resort to encapsulating the 2-3 scenario's in a if/else statement...

It is just much neater if I can check for the if/else and insert the proper operator >=< (kind of looks like a space ship)

 
Old March 2nd, 2005, 03:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jonax
Default

<%
vStartWeekOnWhatDayOriginal = "03/22/2005"
vFollowUp = "02/22/2005"
vTest = "<="
if eval(vStartWeekOnWhatDayOriginal & vTest & vFollowUp) = true then
    'The condition is true!
    response.Write "Yup, it's true!"
else
    'The condition is false!
    response.Write "Nope, it's false!"
end if
%>







Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use like operator thillaiarasu SQL Server 2000 4 April 23rd, 2010 09:47 AM
=== operator in c# surendraparashar C# 2005 8 November 8th, 2007 05:14 AM
Invalid operator for data type. Operator equals di Pusstiu SQL Server 2000 2 August 10th, 2007 04:51 AM
SQL 'Between' operator daveyh BOOK: Beginning SQL 2 April 4th, 2007 03:25 PM
Use of return operator. PC BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 3 July 1st, 2005 09:54 AM





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