Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

type mismatch 800A000D, help!

Hi,

i'm new in vb script...and i can't figure out the error of my vb script.
here it is:
*******************
130 Set RSCount = MyConn.Execute("SELECT COUNT(*) as msg_count
FROM randomlist")
131 upperlimit = RSCount("msg_count")
132 lowerlimit = 1
133 Set RSCount = Nothing
134
135 Randomize
136 Random = Int((upperlimit - lowerlimit + 1) * Rnd() + lowerlimit)
******************

The error is Type Mismatch.
in Line 136
Code: 800A000D
Char: 2


I hope you help me...Your help is greatly appreciated.

thanks

Comments

  • FlakesFlakes Member Posts: 642
    : Hi,
    :
    : i'm new in vb script...and i can't figure out the error of my vb script.
    : here it is:
    : *******************
    : 130 Set RSCount = MyConn.Execute("SELECT COUNT(*) as msg_count
    : FROM randomlist")
    : 131 upperlimit = RSCount("msg_count")
    : 132 lowerlimit = 1
    : 133 Set RSCount = Nothing
    : 134
    : 135 Randomize
    : 136 Random = Int((upperlimit - lowerlimit + 1) * Rnd() + lowerlimit)
    : ******************
    :
    : The error is Type Mismatch.
    : in Line 136
    : Code: 800A000D
    : Char: 2
    :
    :
    : I hope you help me...Your help is greatly appreciated.
    :
    : thanks
    :


    I tried your code like this:(Because i dont have your DB) and it works fine ..

    [code]
    upperlimit = 10
    lowerlimit = 1

    Randomize
    Random = Int((upperlimit - lowerlimit + 1) * Rnd() + lowerlimit)
    response.write Random
    [/code]

    Maybe your sql is returning null or something ? Try this:

    [code]
    Set RSCount = MyConn.Execute("SELECT COUNT(*) as msg_count FROM randomlist")
    If isNull(RSCount("msg_count") ) Then
    Response.write "No Data"
    Else

    upperlimit = RSCount("msg_count")
    lowerlimit = 1
    Set RSCount = Nothing

    Randomize
    Random = Int((upperlimit - lowerlimit + 1) * Rnd() + lowerlimit)
    End If

    [/code]


  • jeremiah05jeremiah05 Member Posts: 3
    Yes, i guess that the database is returning null. I tried your suggestion assigning some value for the upperlimit variable and it worked.

    Thank you so much! =)
Sign In or Register to comment.