Skip to main content
Participating Frequently
October 14, 2010
Question

Type mismatch: 'CLng'

I am currently working through the book "Adobe Dreamweaver CS3: Training From the Source. I am working on Chapter 15 using ASP and would be grateful if somebody could point out what the code should be.

The error message I get is :

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'CLng'

/newland/admin_cp_update_processor.asp, line 32

The relevant code is:

<%
'Create connection object
Dim dbConn
Dim rs_regions
set dbConn = server.CreateObject("adodb.connection")
'Connect to database via DSN
dbConn.open("newland")

Dim countryID_cleaned, region_cleaned, countryName_cleaned, population_cleaned, country_currency_cleaned, description_cleaned, imageURL_cleaned, imageALT_cleaned
countryID_cleaned = CLng(Request.Form("countryID"))
region_cleaned = CLng(Request.Form("region"))
countryName_cleaned = Replace(Request.Form("countryName"),"'","''")
population_cleaned = Replace(Request.Form("population"),"'","''")
country_currency_cleaned = Replace(Request.Form("country_currency"),"'","''")
description_cleaned = Replace(Request.Form("description"),"'","''")
imageURL_cleaned = Replace(Request.Form("imageURL"),"'","''")
imageALT_cleaned = Replace(Request.Form("imageALT"),"'","''")
dbConn.Execute("UPDATE tbl_country SET region='" & region_cleaned & "', countryName='" & countryName_cleaned & "', population='" & population_cleaned & "', country_currency='" & country_currency_cleaned & "', description='" & description_cleaned & "', imageURL='" & imageURL_cleaned & "', imageALT='" & imageALT_cleaned & "' WHERE countryID=" & countryID_cleaned)
Response.Redirect("admin_cp_master.asp")
%>

Line 32 of the code is: countryID_cleaned = CLng(Request.Form("countryID"))

Regards

David

This topic is closed to new replies. Start a new post to keep the conversation going.

4 replies

Participating Frequently
October 14, 2010

What type of value is in Request.Form("countryID") ?  How is it being populated? Can you show us the form.

Translate
Participating Frequently
October 14, 2010

The form is shown above. Employees can update country profiles. I hope this helps!

Regards

David

Translate
Participating Frequently
October 14, 2010

Screenshots don't help. We need to see the code. Is countryID guaranteed to always be numeric?

Translate