We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

An unhandled data type was encountered.

claracruz
claracruz asked
on
Medium Priority
2,072 Views
Last Modified: 2008-03-06
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;-

<%@LANGUAGE="VBSCRIPT"%>
<!--#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"
MyProductAndSizeOnly.store

response.Redirect("product_size_update_price.asp?sizeid="&sizeid&"&productid="&request.querystring("productid"))  
%>


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

Many Thanks
Comment
Watch Question

Commented:
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.

Commented:
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

Commented:
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:

response.Redirect("product_size_update_price.asp?sizeid="&Cint(sizeid)&"&productid="&request.querystring("productid"))  
Wait... it's coming from the querystring.

response.Redirect("product_size_update_price.asp?sizeid="&size_id&"&productid="&request.querystring("productid"))  

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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.