Type mismatch: '[string: ""]'

Discussion in 'ASP General' started by exsuscito@gmail.com, Dec 14, 2005.

  1. Guest

    After about 30 minutes of frustration I finally discovered what was
    causing a general 500 internal server error and to my surprise it was
    something I seem to always take for granted for its simplicity. A type
    mismatch error trying to compare a string to a numerical value, which
    is something that PHP has no problem or qualms with. However, this
    continuous problem continues to haunt me year after year and has
    brought me to tears with frustration. This is the line that raises the
    error:

    nID = Request("ID")
    If IsNull(nID) Or IsEmpty(nID) Or nID = 0 Then
    .... (and so on)

    In the past I've written a function 30 lines long that compares values
    by confirming value types of the variables first, but I would rather
    put a gun to my head than do that. Since there are obviously other
    bright PHP and ASP developers out there that constantly trip over this
    problem, I would like to know your suggestions or methods of working
    around this.
     
    , Dec 14, 2005
    #1
    1. Advertising

  2. Steven Burn Guest

    First, don't use Request("item")... be explicit (i.e. Request.Form or
    Request.Querystring or Request.ServerVariables)

    nID = Request("ID")
    If CStr(nID) <> "" And Len(Trim(CStr(nID))) > 0 Then
    ..... carry on

    Example:

    Empty: http://mysteryfcm.plus.com/misc/nid.asp?nid=
    Null: http://mysteryfcm.plus.com/misc/nid.asp?nid=
    Neither: http://mysteryfcm.plus.com/misc/nid.asp?nid=123

    --
    Regards

    Steven Burn
    Ur I.T. Mate Group
    www.it-mate.co.uk

    Keeping it FREE!

    <> wrote in message
    news:...
    > After about 30 minutes of frustration I finally discovered what was
    > causing a general 500 internal server error and to my surprise it was
    > something I seem to always take for granted for its simplicity. A type
    > mismatch error trying to compare a string to a numerical value, which
    > is something that PHP has no problem or qualms with. However, this
    > continuous problem continues to haunt me year after year and has
    > brought me to tears with frustration. This is the line that raises the
    > error:
    >
    > nID = Request("ID")
    > If IsNull(nID) Or IsEmpty(nID) Or nID = 0 Then
    > ... (and so on)
    >
    > In the past I've written a function 30 lines long that compares values
    > by confirming value types of the variables first, but I would rather
    > put a gun to my head than do that. Since there are obviously other
    > bright PHP and ASP developers out there that constantly trip over this
    > problem, I would like to know your suggestions or methods of working
    > around this.
    >
     
    Steven Burn, Dec 14, 2005
    #2
    1. Advertising

  3. read the 1st part of this article so you see the real errors... that will
    help a shitload

    http://www.powerasp.com/content/hintstips/common_sense.asp




    <> wrote in message
    news:...
    > After about 30 minutes of frustration I finally discovered what was
    > causing a general 500 internal server error and to my surprise it was
    > something I seem to always take for granted for its simplicity. A type
    > mismatch error trying to compare a string to a numerical value, which
    > is something that PHP has no problem or qualms with. However, this
    > continuous problem continues to haunt me year after year and has
    > brought me to tears with frustration. This is the line that raises the
    > error:
    >
    > nID = Request("ID")
    > If IsNull(nID) Or IsEmpty(nID) Or nID = 0 Then
    > ... (and so on)
    >
    > In the past I've written a function 30 lines long that compares values
    > by confirming value types of the variables first, but I would rather
    > put a gun to my head than do that. Since there are obviously other
    > bright PHP and ASP developers out there that constantly trip over this
    > problem, I would like to know your suggestions or methods of working
    > around this.
    >
     
    Kyle Peterson, Dec 14, 2005
    #3
    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. data type mismatch error

    , Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    640
    Karl Seguin
    Aug 10, 2005
  2. Harry Pehkonen

    win32com, string array --> Type mismatch?

    Harry Pehkonen, Aug 8, 2003, in forum: Python
    Replies:
    2
    Views:
    1,874
    Harry Pehkonen
    Aug 11, 2003
  3. Mark Sargent

    Type mismatch: '[string: ""]'

    Mark Sargent, Nov 2, 2003, in forum: ASP General
    Replies:
    10
    Views:
    227
    Mark Sargent
    Nov 5, 2003
  4. Snow
    Replies:
    3
    Views:
    221
    Firas S Assaad
    Oct 27, 2006
  5. programmingzeal
    Replies:
    0
    Views:
    1,129
    programmingzeal
    May 6, 2012
Loading...

Share This Page