Microsoft Knowledge Base Email Alertz

(195180) - 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...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 195180 - Last Review: December 3, 2003 - Revision: 3.1

PRB: VBScript "Type Mismatch" Error When Field Type Is adNumeric

This article was previously published under Q195180

On This Page

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.

MORE INFORMATION

Steps to Reproduce the Behavior

The following code exhibits the above-mentioned error:
<%
    Set oConn = Server.CreateObject("ADODB.COnnection")
    oConn.Open "MyDSN", "MyUserID", "MyPassWord"
    set oRS = oConn.Execute("Select list_price FROM DEMO.PRICE")

    'This is the bad line of code, "list_price" is being returned as
    'type adNumeric.
    Response.Write("List Price * 100 = " & oRS("list_price") * 100)
    %>
				

APPLIES TO
  • Microsoft Open Database Connectivity 2.5
  • Microsoft ActiveX Data Objects 1.0
  • Microsoft ActiveX Data Objects 1.5
  • Microsoft ActiveX Data Objects 2.0
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
  • Microsoft ActiveX Data Objects 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 4.0
  • Microsoft Open Database Connectivity Driver for Visual FoxPro 5.0
Keywords: 
kbprb KB195180
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Anonymous User Report As Irrelevant  
Written: 10/28/2004 12:27 PM
thanks very helpful. I'm moving from Chilisoft ASP to MSoft and b4 i could get away with comparing vars but now i have to CInt them first

Anonymous User Report As Irrelevant  
Written: 10/30/2005 11:47 PM
My problem: Not able to use the Cint function. The following error appears in the browser: variable automation type not supported in VBscript:Cint. Please provide solution if posible at gamsys@rediffmail.com