Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type mismatch: '[string: ""]'

Tags:

asp-classic

I receive the following error when there is no value for querystring. (I mean like index.asp?ID=).

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: ""]'

index.asp, line 10

I tried converting NULL value to something else with the following code. It did not work.

MEMBERID        = Request.QueryString("ID")

If MEMBERID = "" or MEMBERID = 0 Then
    MEMBERID = Session("MEMBERID")
End If
like image 523
Efe Tuncel Avatar asked Jan 10 '10 17:01

Efe Tuncel


People also ask

What is a type mismatch?

This error indicates that Access cannot match an input value to the data type it expects for the value. For example, if you give Access a text string when it is expecting a number, you receive a data type mismatch error.

What is type mismatch error in VBScript?

These error messages occur because VBScript cannot properly convert adNumeric values to a valid numeric type. This behavior is by design.

What is Microsoft VBScript runtime error?

VBScript run-time errors are errors that result when your VBScript script attempts to perform an action that the system cannot execute. VBScript run-time errors occur while your script is being executed; when variable expressions are being evaluated, and memory is being dynamic allocated.


1 Answers

OK, you're getting the parameter ID from the QueryString and checking if it's empty or zero, right? So, you should do something like:

MemberId = Request.QueryString("ID")
'*
'* Check for other than numbers just to be safe
'*
If (MemberId = "" Or Not IsNumeric(MemberId)) Then
   MemberId = Session("MemberId")
End If
'*
'* We can't add this check on the above if because
'* in classic ASP, the expression is evaluated as a whole
'* which would generate an exception when converting to Int
'*
If (CInt(MemberId) = 0) Then
   MemberId = Session("MemberId")
End If
like image 196
Paulo Santos Avatar answered Sep 25 '22 01:09

Paulo Santos