Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if statement going rouge 1

Status
Not open for further replies.

penguinspeaks

Technical User
Nov 13, 2002
234
US
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??
 
A string cannot be 'greater than' another string, unless one string is empty or NULL.

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
 
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
 
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.
 
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
 
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~!!
 
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
 
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.
 
You could have used clng instead of cdbl if it is just integer/long arithmetic.
 
xwb What would be the difference or advantage in using that versus cdbl in my scenario??
 
Rounding errors - with doubles, sometimes 5.0 doesn't equal 5.0
 
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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top