|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

February 27th, 2005, 03:43 PM
|
|
Registered User
|
|
Join Date: Sep 2004
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

March 1st, 2005, 07:14 PM
|
|
Registered User
|
|
Join Date: Sep 2004
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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)
|

March 2nd, 2005, 03:46 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: , , Denmark.
Posts: 184
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<%
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
%>
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |