Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Odd behaviour in an ASP Class function

    I wrote out a fairly complex function (lots of looping and comparing) and placed in as a Public Sub in a class module. It works as expected in one page but in another page the key test fails to fire. Since I am handing data over to the same sub it's a complete puzzle to me why this is occurring. the main test is this:
    <font face="Georgia">
    Do While Not Recipient.EOF
    If Recipient.Fields("ComplainantID") = CompID_Value Then
    CompValue = 1
    Response.Write "Recipient " & "< br>"
    Exit Do
    End If
    Recipient.MoveNext
    </font face=georgia>
    and it works fine in a page where the value for ComplainantID is read from a db connection. in another page I pass the value along using Request("ComplainantID") and the value does indeed show up in the sub but the compare simply doesn't fire. Any ideas??

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd behaviour in an ASP Class function

    Your posted code may just be incomplete, but you're missing the Loop at the end. I trust that's already there in your actual code.

    The only thing I can think of at this point is data type problems. Make sure your CompID_Value is always the same type. You may need to use CINT() to convert it from string (default when reading from Querystring) - or whatever corresponds to the data type of the ComplainantID field.

    Hope this helps!

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Odd behaviour in an ASP Class function

    yes, Cint() did the trick. I certainly suspected data type but ASP, of course, doesn't recognize Dim Blah as Integer. anyhow, it works now. Thanks!

Posting Permissions

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