INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

if statement going rouge

if statement going rouge

(OP)
My simple statement is not sending to the correct place.
here is code:

CODE

if cStr(rsv) > cStr(dm) then
	response.redirect "premium2.asp?id="&var1&""
	else
        response.redirect "voucher_success.asp?id="&vid&""
        end if 

just so you know the variables, and I have tested the results are

dm= 2478556480
rsv = 1500000

Now I cannot use Cint as the DM variable is too much.
The issue is this.... the page redirect is going to the premium2.asp page when you can clearly see that the dm variable is higher.

Why is this doing this??

the whole code is...

CODE

<%

var1 = request.form("id")
'response.write var1

set info1 = conn.execute("select Premiumv, darkmatter from uni1_users where id = "&var1&"")
ps=info1.fields.item("Premiumv").value
dm=cstr(info1.fields.item("darkmatter").value)

var2 = request.form("premium")
pu = info1.fields.item("premium_until").value


var2 = cint(request.form("premium"))
'response.write var2
'response.write pu
'response.write var3
'response.write dm

	if var2 = 7 then
		rsv = 250000
	elseif var2 = 14 then
		rsv = 400000
	elseif var2 = 30 then
		rsv = 750000
	elseif var2 = 90  then
		rsv = 1500000
	elseif var2 = 180 then
		rsv = 2500000
	end if
	'response.write rsv

	if cStr(rsv) > cStr(dm) then
	response.redirect "premium2.asp?id="&var1&""
	else
        response.redirect "voucher_success.asp?id="&vid&""
        end if

%> 
As you can see I have tested every possible variable result so the accuracy is there.
of course I will have it do other functions prior to sending to second page but I am testing as I go and am stuck here.

any help PLEASE??

RE: if statement going rouge

A string cannot be 'greater than' another string, unless one string is empty or NULL.

Quote:

Now I cannot use Cint as the DM variable is too much.

Then use a 'long' integer.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: if statement going rouge

Oh, by the way I guess you mean 'rogue' (wild or untamed) rather than 'rouge', French for red and used to describe make up usually applied to the cheeks as a 'blusher'. :)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: if statement going rouge

(OP)
lol, you are correct on my improper grammar.

I did solve the issue.

I used cdbl instead of Cint of Cstr. This made all of the formulas work.

RE: if statement going rouge

Quote:

lol, you are correct on my improper grammar.

Oh I do the same thing every day, hitting the keys in the worng ordre seems to be a common affliction among "two finger typists". :)

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: if statement going rouge

(OP)
Well, I can only use one hand due to a stroke. So for the last 6 months, I have learned to use all of my fingers on the right hand to type.
Trust me, it sucks~!!

RE: if statement going rouge

Quote:

Well, I can only use one hand due to a stroke.... Trust me, it sucks~!!
Believe me I know exactly how badly 'it sucks'. I have the same problems, left hand is at best "clunky" so gets to press the shift and control keys on the 'good days' but I still haven't managed to get better than one finger (and thumb for the space bar) on the right hand. but c'est la vie :)

Though I do prefer to be known as a "stroke survivor" rather than a "stroke victim", a small distinction it may be, but it is an important one from my point of view. Long may you keep up the battle mate.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: if statement going rouge

(OP)
Same to you. Mine was very close to mid-line. Left side was completely paralyzed. Unfortunately I was in the small percentage of people who has their speech center on the right side of their brain. So since the stroke hit the right side but close to mid-line, I had to learn how to talk again.

I can talk, walk at about a level 7 out of ten. I can use my left arm, shoulder movement, elbow movement, just nothing out of wrist , hand, and fingers mostly.

As you said, on good days, I can talk a finger into hitting the ctrl, fnct, or alt button.

Godspeed in your recovery as well.

RE: if statement going rouge

You could have used clng instead of cdbl if it is just integer/long arithmetic.

RE: if statement going rouge

(OP)
xwb What would be the difference or advantage in using that versus cdbl in my scenario??

RE: if statement going rouge

Rounding errors - with doubles, sometimes 5.0 doesn't equal 5.0

RE: if statement going rouge

(OP)
ok. I have changed all instances of the cdbl to clng. so far it acts the same way so all is well.
Thank You for the tip!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close