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

SQL query problem

Guest
May 27, 2006 May 27, 2006

Copy link to clipboard

Copied

Help, Please.

I have an SQL query that I have put into a script that when I run the whole thing, I get an error that tells me there is a missing operator. I am working on the book by Jeff Bardzell of Dreamweaver 8 for ASP etc. I am in the last lesson and I just can't seem to find my problem. My query is identical to Jeff's I will include it below and maybe you can tell me what is wrong.

Thanks

<%
Dim description_fixed, imageALT_fixed
description_fixed = Replace(Request.Form("description"),"'","&#39;")
imageALT_fixed = Replace(Request.Form("imageALT"),"'","&#39;")

Dim dbConn
set dbConn = server.CreateObject("adodb.connection")
dbConn.open("newland")
dbConn.Execute("UPDATE tbl_country SET region='" & Request.Form("region") & "', countryName='" & Request.Form("countryName") & "', population='" & Request.Form("population") & "', country_currency='" & Request.Form("country_currency") & "', description='" & description_fixed & "', imageURL='" & Request.Form("imageURL") & "', imageALT='" & imageALT_fixed & "' WHERE countryID=" & Request.QueryString("countryID"))
Response.Redirect("admin_cp_master.asp")
%>
TOPICS
Server side applications

Views

208
Translate

Report

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 ,
May 28, 2006 May 28, 2006

Copy link to clipboard

Copied

Most likely that some of your variables are holding incorrect values. I'd
suggest that you build up the string in a local vaiable and then execute it.
This way you can troubleshoot. eg

strSql="update mytable set mycol=1"
Response.Write strSql : Response.End
dbConn.Execute(strSql)

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004





Votes

Translate

Report

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 ,
May 29, 2006 May 29, 2006

Copy link to clipboard

Copied

LATEST
All your parameters are in the Form collection except countryID.
Try changing to:

WHERE countryID=" & Request.Form("countryID")

-Roman

"zavidp" <webforumsuser@macromedia.com> wrote in message
news:e5b79p$jeu$1@forums.macromedia.com...
> Help, Please.
>
> I have an SQL query that I have put into a script that when I run the
> whole
> thing, I get an error that tells me there is a missing operator. I am
> working
> on the book by Jeff Bardzell of Dreamweaver 8 for ASP etc. I am in the
> last
> lesson and I just can't seem to find my problem. My query is identical to
> Jeff's I will include it below and maybe you can tell me what is wrong.
>
> Thanks
>
> <%
> Dim description_fixed, imageALT_fixed
> description_fixed = Replace(Request.Form("description"),"'","&#39;")
> imageALT_fixed = Replace(Request.Form("imageALT"),"'","&#39;")
>
> Dim dbConn
> set dbConn = server.CreateObject("adodb.connection")
> dbConn.open("newland")
> dbConn.Execute("UPDATE tbl_country SET region='" & Request.Form("region")
> &
> "', countryName='" & Request.Form("countryName") & "', population='" &
> Request.Form("population") & "', country_currency='" &
> Request.Form("country_currency") & "', description='" & description_fixed
> & "',
> imageURL='" & Request.Form("imageURL") & "', imageALT='" & imageALT_fixed
> & "'
> WHERE countryID=" & Request.QueryString("countryID"))
> Response.Redirect("admin_cp_master.asp")
> %>
>
>


Votes

Translate

Report

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