PRB: VBScript "Type Mismatch" Error When Field Type Is adNumeric (195180)
The information in this article applies to:
- Microsoft ODBC for Oracle version 2.5 Build 2.573.2927
- ActiveX Data Objects (ADO) 1.0
- ActiveX Data Objects (ADO) 1.5
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
- Microsoft Data Access Components 1.5
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.7
- Microsoft Active Server Pages
- Microsoft ODBC Driver for Visual FoxPro 5.0
This article was previously published under Q195180 SYMPTOMS
When you perform a numeric comparison or calculation on an adNumeric (131)
field type using VBScript, the following errors may be returned:
Microsoft VBScript runtime error '800a000d'
Type mismatch
Microsoft VBScript runtime error '800a01ca'
Variable uses an Automation type not supported in VBScript
CAUSE
The errors occur because VBScript cannot properly convert adNumeric values
to a valid numeric type.
RESOLUTION
You can use either of the following two possible workarounds:
- Convert the adNumeric field using CDbl() (or CInt()) as in the
following example:
<%@ LANGUAGE="VBScript"%>
<%
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "MyDSN", "MyUserID", "MyPassWord"
set oRS = oConn.Execute("Select list_price FROM DEMO.PRICE")
Response.Write("List Price * 100 = " & CDbl(oRS("list_price")) * 100)
%>
-or-
-
Use JScript, because JScript does not exhibit this behavior.
Modification Type: | Major | Last Reviewed: | 12/3/2003 |
---|
Keywords: | kbprb KB195180 |
---|
|