CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Why Does redirect not work?

Print topic Send  topic

Author Message
Nate
Posted: 06/17/2003, 6:38 PM

Using CCS 2.1.1.20
ASP

Can someone tell me why the "else" statement is not working?

I am comparing two numbers stored in a table to determine if a record should be created in a second table. The first part of the IF statement works fine, if test results is true.

When the test results = false, the first statement following the "Else" works (the record is not inserted), however, the user is not redirected to the failur12 page.

Any ideas?

Code listed below.

Thanks much

======================= Before Insert Custom Code ==================

CurrentCount = CCDLookUp("ClassCount","Classes","ClassID=" &student.ClassID.value, DBadminDB)
MaxCount = CCDLookUp("ClassMaxNumber","Classes","ClassID=" &student.ClassID.value, DBadminDB)


If CurrentCount < MaxCount Then
Student.InsertAllowed = True
redirect = "success.asp"
Else
Student.InsertAllowed = False
redirect = "failure12.asp"
End if
Janice Scott
Posted: 07/15/2003, 8:43 AM

don't know didly about asp but could your problem be that your 'if' statement can never be false. When I use a MaxCount it is usually to limit a conditional. If that is what you are doing then the 'if' statement will never be false.

Maybe that is too obvious but sometimes the most obvious things are the easiest to overlook.

Janice
GreggB
Posted: 07/15/2003, 12:05 PM

Try adding CCToSQL() as below.

CurrentCount = CCDLookUp("ClassCount","Classes","ClassID=" & CCToSQL(student.ClassID.value, “Integer”) DBadminDB)
MaxCount = CCDLookUp("ClassMaxNumber","Classes","ClassID=" & CCToSQL(student.ClassID.value, “Integer”) DBadminDB)


If the above doesn’t work, verify if your code actually works by substituting Integers in place of the variables for CurrentCount and MaxCount.


If 5 < 5 Then
Student.InsertAllowed = True
redirect = "success.asp"
Else
Student.InsertAllowed = False
redirect = "failure12.asp"
End if


GreggB

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.