[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1950
  • Last Modified:

An unhandled data type was encountered.

Hello experts am getting the following error;-
Response object error 'ASP 0106 : 80020005'

Type Mismatch

/bdtadmin/product_size_insert_price.asp, line 0

An unhandled data type was encountered.

I cannot for the life of me figure out why the error is occurring. Please see code below;

Code on page is as follows;-

<!--#include file="../Connections/adconnproducts.asp" -->
<!-- #INCLUDE file="../dbComm/cStoreFront.asp" -->
<!-- #INCLUDE file="../dbComm/cPriceByOption.asp" -->
<!-- #INCLUDE file="../dbComm/cProducts.asp" -->
<!-- #INCLUDE file="../dbComm/cSizes.asp" -->
<!-- #INCLUDE file="../dbComm/i_helper.asp" -->

dim MyProductAndSizeOnly
Set MyProductAndSizeOnly = new cPriceByOption

dim product_id
dim size_id
dim storage_type_id
dim base_id
dim storage_option_id

product_id = request.querystring("productid")
size_id = request.querystring("sizeid")
storage_type_id = 0
base_id = 0
storage_option_id = 0

MyProductAndSizeOnly.product_id = cint(product_id)
MyProductAndSizeOnly.size_id = cint(size_id)
MyProductAndSizeOnly.storage_type_id = cint(storage_type_id)
MyProductAndSizeOnly.base_id = cint(base_id)
MyProductAndSizeOnly.storage_option_id = cint(storage_option_id)
MyProductAndSizeOnly.price = 0
MyProductAndSizeOnly.status = "live"


But the funny thing is I get the error on first try, then if I refresh the page, it works fine.#

Many Thanks
  • 2
  • 2
1 Solution
It's very difficult to debug this because I cannot run the code. What you could/should try is removing the cint(...) parts and setting them to 0 for testing. I believe it's probably in one of them.
Find out which datatype it is. Sometimes a database can return a datatype "decimal" which is unknown to VBScript

Response.write TypeName(variable)

See also http://www.aspfaq.com/show.asp?id=2330
I remember having a similar problem with using SELECT @@IDENTITY on MS SQL Server. That returns a variable of type Decimal. In VBScript you can not process that type, you first need to convert it with CInt, Clng or (for large numbers) with Cdbl.

That would maybe explain that the error is only on the first try (an insert), on an update, there is no such problem.
You converted sizeid further up but didn't do it again for the redirect. Try this:

Wait... it's coming from the querystring.


Maybe the problem is your variable name was wrong so it was trying to concatenate a "Nothing" with a string. Try the above.

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now