SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Is Bigger Than?

  1. #1
    What a twist! Kings's Avatar
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    954
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is Bigger Than?

    I must be stupid or something but with the following code;
    [vbs]
    If intPageSize < UBound(dbMembers, 2) Then
    mlist_length = intPageSize
    Else
    mlist_length = UBound(dbMembers, 2)
    End If
    [/vbs]

    mlist_length = 398, even though intPageSize = 30 and UBound(dbMembers, 2) = 398.

    Can someone tell me wtf is wrong?
    Dennis Pallett - NoCertainty - My Personal Weblog
    The Web Network: ASPit | PHPit | WebDev-Articles
    Blogs: TalkFones | Holidayzer | PHPit Blog

  2. #2
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    URL?

    It'd be good to response.write out the values of the things you are testing so you can literally see them, including converting the datatypes.

    J
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  3. #3
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,264
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    Are they both numeric for sure? And have values right then and there? You might want to do a clng on both of those values just to be sure you're comparing apples to apples...
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  4. #4
    What a twist! Kings's Avatar
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    954
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It isn't online; It's on my localhost. And what do you mean with converting the datatypes?

    btw, here are the values when I "response.writed" them,
    mlistlength = 398
    intPageSize = 30
    UBound(dbMembers, 2) = 398
    code used for that,
    [vbs]
    Response.Write "mlistlength = " & mlist_length & "<br>"
    Response.Write "intPageSize = " & intPageSize & "<br>"
    Response.Write "UBound(dbMembers, 2) = " & UBound(dbMembers, 2)
    [/vbs]
    Dennis Pallett - NoCertainty - My Personal Weblog
    The Web Network: ASPit | PHPit | WebDev-Articles
    Blogs: TalkFones | Holidayzer | PHPit Blog

  5. #5
    What a twist! Kings's Avatar
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    954
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bah, it worked. The "clng" did it. Mind telling me what it is and if you have any tutorials/faq/articles for it?
    Dennis Pallett - NoCertainty - My Personal Weblog
    The Web Network: ASPit | PHPit | WebDev-Articles
    Blogs: TalkFones | Holidayzer | PHPit Blog

  6. #6
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,264
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    clng converts a string or variant to a numeric value. You could also use cint, but that limits you to a size of 32,767 where clng is unlimited (essentially, there is an limit, but don't remember the value).

    Basically, what happened was you were comparing a numeric value with a string value so the conversion was changing the value. What you did was force it to compare numeric to numeric.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  7. #7
    What a twist! Kings's Avatar
    Join Date
    Jul 2002
    Location
    The Netherlands
    Posts
    954
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah, I understand. Thanks! (Jeremy, Thanks too)
    Dennis Pallett - NoCertainty - My Personal Weblog
    The Web Network: ASPit | PHPit | WebDev-Articles
    Blogs: TalkFones | Holidayzer | PHPit Blog

  8. #8
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,264
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by Kings
    ah, I understand. Thanks! (Jeremy, Thanks too)
    Glad I could help and that you got it working....
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse


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
  •