0
SQL query problem

/t5/dreamweaver-discussions/sql-query-problem/td-p/817171
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"),"'","'")
imageALT_fixed = Replace(Request.Form("imageALT"),"'","'")
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")
%>
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"),"'","'")
imageALT_fixed = Replace(Request.Form("imageALT"),"'","'")
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/dreamweaver-discussions/sql-query-problem/m-p/817172#M151853
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/dreamweaver-discussions/sql-query-problem/m-p/817173#M151854
May 29, 2006
May 29, 2006
Copy link to clipboard
Copied
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"),"'","'")
> imageALT_fixed = Replace(Request.Form("imageALT"),"'","'")
>
> 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")
> %>
>
>
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"),"'","'")
> imageALT_fixed = Replace(Request.Form("imageALT"),"'","'")
>
> 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")
> %>
>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

