Skip to main content
May 28, 2006
Question

SQL query problem

  • May 28, 2006
  • 2 replies
  • 232 views
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")
%>
This topic has been closed for replies.

2 replies

Inspiring
May 30, 2006
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")
> %>
>
>


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