Trying to generate an error

Discussion in 'ASP General' started by Ray at, Sep 18, 2003.

  1. Ray at

    Ray at Guest

    Response.Write CInt("x")


    Do you have an "On Error Resume Next" in your code?

    Ray at work

    "DrewM" <> wrote in message
    news:%...
    > This is a strange request - but I'm trying to generate a Type Mismatch
    > error. It's for an example in some documentation.
    >
    > I was looking for something that would error (like a mathematical equation
    > using a string) that could be simply fixed using CInt(). However, the
    > strings are getting converted at run time so I can't get the error to

    throw!
    >
    > Any ideas?
    >
    > Drew
    >
    >
    Ray at, Sep 18, 2003
    #1
    1. Advertising

  2. Ray at

    DrewM Guest

    This is a strange request - but I'm trying to generate a Type Mismatch
    error. It's for an example in some documentation.

    I was looking for something that would error (like a mathematical equation
    using a string) that could be simply fixed using CInt(). However, the
    strings are getting converted at run time so I can't get the error to throw!

    Any ideas?

    Drew
    DrewM, Sep 18, 2003
    #2
    1. Advertising

  3. Ray at

    DrewM Guest

    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:...
    > Response.Write CInt("x")
    >
    > Do you have an "On Error Resume Next" in your code?


    Thanks Ray. There's no OERN in my page - it's just pretty much an empty
    document.

    I can get the error by doing something like:

    Dim myInt, myString
    myInt = 3
    myString = "three"

    if myInt + myString = 6 Then
    response.write "match!"
    end if

    but I really wanted to do it with numbers so i could then show how CInt
    solves the problem.

    Any thoughts?

    Drew
    DrewM, Sep 18, 2003
    #3
  4. Ray at

    Ray at Guest

    Well CInt won't solve the problem if you're using strings, unless you have
    numeric strings.

    Dim x, y
    x = 1
    y = "5"
    Response.Write x + y

    That will work without the need for cint'ing.

    What are you trying to do here?

    Ray at work



    "DrewM" <> wrote in message
    news:...
    > "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    > news:...
    > > Response.Write CInt("x")
    > >
    > > Do you have an "On Error Resume Next" in your code?

    >
    > Thanks Ray. There's no OERN in my page - it's just pretty much an empty
    > document.
    >
    > I can get the error by doing something like:
    >
    > Dim myInt, myString
    > myInt = 3
    > myString = "three"
    >
    > if myInt + myString = 6 Then
    > response.write "match!"
    > end if
    >
    > but I really wanted to do it with numbers so i could then show how CInt
    > solves the problem.
    >
    > Any thoughts?
    >
    > Drew
    >
    >
    Ray at, Sep 18, 2003
    #4
  5. Ray at

    DrewM Guest

    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:...

    > What are you trying to do here?


    Heh - fair question :)

    I think endless hours of document writing have fried my brain.
    Let me go away and get my thoughts straight.

    Thanks for the help.

    Drew
    DrewM, Sep 18, 2003
    #5
  6. Ray at

    Dan Brussee Guest

    On Thu, 18 Sep 2003 17:09:46 +0100, "DrewM" <>
    wrote:

    >"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    >news:...
    >
    >> What are you trying to do here?

    >
    >Heh - fair question :)
    >
    >I think endless hours of document writing have fried my brain.
    >Let me go away and get my thoughts straight.
    >
    >Thanks for the help.
    >



    If you are calling a COM object and do the following:

    dim obj, x

    set obj = server.createobject("object.thing")
    x = 5
    obj.SendAnInteger x

    This will fail if the parameter in SendAnInteger requries an integer.
    This is because all variables in ASP are variants. In this case you
    would need to use cint() to satisfy the method interface.
    Dan Brussee, Sep 18, 2003
    #6
  7. Ray at

    PB4FUN Guest

    Try this :)
    <%
    Err.Raise 13,"Type Mismatch"
    %>

    Gets you this :

    Technical Information (for support personnel)

    Error Type:
    Type Mismatch (0x800A000D)
    Type mismatch



    Meindert, MCP


    > This is a strange request - but I'm trying to generate a Type Mismatch
    > error. It's for an example in some documentation.
    >
    > I was looking for something that would error (like a mathematical equation
    > using a string) that could be simply fixed using CInt(). However, the
    > strings are getting converted at run time so I can't get the error to

    throw!
    >
    > Any ideas?
    >
    > Drew
    >
    >
    PB4FUN, Sep 18, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Weng Tianxiang
    Replies:
    5
    Views:
    1,301
    Christophe
    Feb 16, 2006
  2. Mary
    Replies:
    1
    Views:
    3,981
    Thomas Fritsch
    Oct 11, 2004
  3. Charles Krug
    Replies:
    5
    Views:
    278
    Charles Krug
    Jan 18, 2006
  4. Replies:
    3
    Views:
    402
    red floyd
    Apr 7, 2006
  5. Harlan Messinger
    Replies:
    2
    Views:
    2,282
    John Bell
    Mar 28, 2010
Loading...

Share This Page