Forums
This topic is locked
Syntax error in UPDATE statement
Posted 30 Jan 2006 09:28:49
1
has voted
30 Jan 2006 09:28:49 likez praise posted:
i want to update my record but theres an error....Syntax error in UPDATE statement. line 11. the code is
<%
MsgNo=request.querystring("MsgNo"
set con = server.createobject("ADODB.Connection"
scon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(".././dbase/thesis.mdb" & ";"
con.open scon
a= Trim(request("passcode")
sql= "update tblOJTStud set Password= '"&a&"' where StudID="&StudID
con.execute(sql)
Response.redirect "adminOJTshowStudmain.asp?sortby=StudID"
con.close
set con=Nothing
%>
Can somebody help me with this?? Any help is more than appreciated! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replies
Replied 31 Jan 2006 13:56:59
31 Jan 2006 13:56:59 Tom Theys replied:
you call a variable here: StudID= "&StudID
But I don't see where you define the StudID
Try adding this at the start of your code
<b>
Dim strStudID
strStudID = scon.Fields.item("StudID".Value
</b>
and the change this
<b>
sql= "update tblOJTStud set Password= '"&a&"' where StudID=" & strStudID
</b>
But I don't see where you define the StudID
Try adding this at the start of your code
<b>
Dim strStudID
strStudID = scon.Fields.item("StudID".Value
</b>
and the change this
<b>
sql= "update tblOJTStud set Password= '"&a&"' where StudID=" & strStudID
</b>