Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Type mismatch: 'CLng'

New Here ,
Oct 14, 2010 Oct 14, 2010

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

TOPICS
Server side applications
2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 14, 2010 Oct 14, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2010 Oct 14, 2010

Newland.jpg

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

Regards

David

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 14, 2010 Oct 14, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2010 Oct 14, 2010
LATEST

Thanks for your time. I have found the typo that caused the error now.

Regards

David

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines