Training
Module
Convert data types using casting and conversion techniques in C# - Training
Explore using C# techniques for casts and conversions.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article helps you resolve the Type Mismatch error that occurs when field type is adNumeric
.
Original product version: Internet Information Services
Original KB number: 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 uses an Automation type not supported in VBScript
The errors occur because VBScript cannot properly convert adNumeric
values to a valid numeric type.
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)
%>
Use JScript, because JScript does not exhibit this 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)
%>
Training
Module
Convert data types using casting and conversion techniques in C# - Training
Explore using C# techniques for casts and conversions.