Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Type mismatch: '[string: ""]'

Reply
Thread Tools

Type mismatch: '[string: ""]'

 
 
exsuscito@gmail.com
Guest
Posts: n/a
 
      12-14-2005
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.

 
Reply With Quote
 
 
 
 
Steven Burn
Guest
Posts: n/a
 
      12-14-2005
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=%20
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!

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.
>



 
Reply With Quote
 
 
 
 
Kyle Peterson
Guest
Posts: n/a
 
      12-14-2005
read the 1st part of this article so you see the real errors... that will
help a shitload

http://www.powerasp.com/content/hint...mmon_sense.asp




<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
type(d) != type(d.copy()) when type(d).issubclass(dict) kj Python 5 12-26-2010 06:48 PM
#define ALLOCIT(Type) ((Type*) malloc (sizeof (Type))) Yevgen Muntyan C Programming 10 02-13-2007 02:52 AM
type casting vs. type converting Toby VHDL 3 09-07-2005 01:42 PM
Re: Type casting- a larger type to a smaller type pete C Programming 4 04-02-2004 05:19 PM
Re: Type casting- a larger type to a smaller type heyo C Programming 3 04-01-2004 06:35 PM



Advertisments