SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Syracuse
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with statement

    I'm trying to write a statement that says if a course code is between a particular range and a field is null, then a certain page should be displayed:

    Code:
    if eval(coursecode) >= 24 and eval(coursecode) <= 44 then
    if rs("ce_has_degree") = null then
    redirectline = "supplemental_form.asp?filekey=" & filekey
    response.redirect redirectline
    end if
    end if
    I don't get an error, but I also don't get the supplemental_form.asp page. Can someone tell me what I'm doing wrong? I seem to have a horrible time getting nulls to work properly.

    Thanks in advance.

    Michelle

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does courseCode contain - is it coming from a database? or is it "just" a variable..

    Code:
    if eval(Cint(coursecode)) >= 24 and eval(Cint(coursecode)) <= 44 then
     if Len(rs("ce_has_degree")) < 1 then
      redirectline = "supplemental_form.asp?filekey=" & filekey
      response.redirect redirectline
     end if
    end if
    try that...

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Syracuse
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    courseCode is an id number that comes from a table that generates the active classes.

    If I try what you suggested, I'm getting

    Microsoft VBScript runtime error '800a005e'
    Invalid use of Null: 'Cint'
    bill.asp, line 74

    Which is where I changed the code to read
    if eval(Cint(coursecode)) >= 24 and eval(Cint(coursecode)) <= 44 then

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That would mean that the variable courseCode is null...You cannot do a Cint() on a null value - however your problem at the moment is the fact that courseCode is null and thus is not the id number from the table. You will need to find out why this is so in order to proceed. Post the code in which you're tryin to get the value from the table and I'll be glad to help.

  5. #5
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Syracuse
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks that helps me understand - I'll look at my code, but here it is in the meantime:
    Code:
    <%	
    sub getcoursedesc (coursenumber,coursedesc,coursecost)
    	coursecode = rs("ce_reg_class_" & coursenumber)
    	coursecost = rs("ce_reg_price_" & coursenumber)
    
    	if eval(Cint(coursecode)) >= 24 and eval(Cint(coursecode)) <= 44 then
           if Len(rs("ce_has_degree")) < 1 then
    	redirectline = "supplemental_form.asp?filekey=" & filekey
            response.redirect redirectline
    	end if
    	end if
            coursedesc = coursecode
            ssql = "select ce_description from ce_reg_management"
    	ssql = ssql & " where ce_classcode = '" & coursecode & "'"
            set rs2=cn.execute(ssql)
            while not rs2.eof 
            coursedesc = rs2("ce_description")
            rs2.movenext
    	wend
    	end sub%>
    Last edited by mtarby; Apr 4, 2005 at 11:33. Reason: typo

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am kind of confused as to what you're doing here...

    Code:
    coursecode = rs("ce_reg_class_" & coursenumber)
    'Basically I'm confused what that recordSet is doing there...
    if you're passing in courseNumber (which is what seems is happening?) why don't you just do..

    Code:
    courseCode = courseNumber

  7. #7
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Syracuse
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry - I'm actually trying to pick up the pieces of someone else's work here. The way I understand it - people can register for up to five courses. I think that's what that routine is doing

  8. #8
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm. Well, if that's what it is doing I certainly don't see that logic within the subProc. It looks to me like it's just returning a course description given a coruse code (not including your if statement)

    Also there is a while loop in there for the course description(s)..

    Code:
        while not rs2.eof 
            coursedesc = rs2("ce_description")
            rs2.movenext
       wend
    That loop is kind of useless, since if there was more than one descrip. (not sure if thats possible, but if it isn't then why the loop?) it would just overwrite the variable with the next value...

  9. #9
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Syracuse
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe I'll get further if I start fresh and just re-write it myself! Thanks for the guidiance though!

  10. #10
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •