PDA

View Full Version : please help


jarv
10-24-2008, 01:13 PM
Problem with my string, need help

<!--#include file="includes/functionlib.asp" -->
<%
objconn.execute("UPDATE homepage SET Body = " & Body & " AND Title = '" & Title )

msg = "Updated!"
set rs = nothing
closedb()

response.redirect "settings.asp?msg=" & msg
%>

abduraooft
10-24-2008, 01:18 PM
Please help us by following http://www.codingforums.com/postguide.htm, especially the second one(and third?). (You may edit your thread)

Shoot2Kill
10-24-2008, 01:44 PM
is there supposed to ba a single quote ' before the title ???

hinch
10-24-2008, 03:46 PM
objconn.execute("UPDATE homepage SET Body = '" & Body & "' AND Title = '" & Title &"'")

should do it

jarv
10-24-2008, 04:44 PM
objconn.execute("UPDATE homepage SET Body = '" & Body & "' AND Title = '" & Title &"'")

should do it

Thanks, I tried that.... I now don't get any errors but I get teh Body changes to 0 and nothing updates

jarv
10-24-2008, 04:48 PM
so now i just have:


<!--#include file="includes/functionlib.asp" -->
<%
logincheck()
opendb()
Dim Body : Body = EncodeSQL(request.Form("Body"))
Dim Title : Title = EncodeSQL(request.Form("Title"))

objconn.execute("UPDATE homepage SET Body = '" & Body & "' AND Title = '" & Title &"'")

msg = "Updated!"
set rs = nothing
closedb()
response.redirect "settings.asp?msg=" & msg
%>

hinch
10-24-2008, 05:10 PM
if your updating a int field then you don't need the single quotes ' you only need them if your inserting a string.

so atm the query is setup for a string update if body is an int it needs changing to Body = " & Body & "

same goes with Title

jarv
10-27-2008, 09:21 AM
ok so i removed the single quotes ' ' now i get the error: Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression '<div id="lipsum"> <p> </p><p> Sidcom Southern Limited is a highly experienced and enthusiastic sign manufacturing and <a href="page.asp?PageNo=2" title="Sign Installation">installation</a> company. </p> <p> Based in Romsey on the South Hampshire '.

/update_home.asp, line 8

hinch
10-27-2008, 11:53 AM
so it is a string so it needs the single quotes then the sql query is correct when you put back in the single quotes so I assume its something to do with how your opening your db and such

i rarely use conn.execute so no idea really if it works properly or not.

jarv
10-27-2008, 03:56 PM
it was the objconn.execute

this works fine now!

SQL1="UPDATE homepage SET Body = '" & Body & "', Title = '" & Title &"'"
objConn.Execute (SQL1)


Thanks for your help Hinch!

jarv
10-27-2008, 03:56 PM
it was the objconn.execute

this works fine now!

SQL1="UPDATE homepage SET Body = '" & Body & "', Title = '" & Title &"'"
objConn.Execute (SQL1)


Thanks for your help Hinch!