Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2006
    Posts
    10

    Unanswered: Syntax error in UPDATE statement.

    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! :-)

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    how are you getting/setting the value for StudID? It doesn't appear in the posted code....

    Other problems could be in the content of the password.

    Before your con.execute line add in Response.Write(sql) and post the resulting line here.

  3. #3
    Join Date
    Nov 2005
    Location
    Honolulu HI
    Posts
    119
    it looks like you are not actually retrieving a value for a
    "a= Trim(request("passcode"))"

    "request" what ?
    also.. is StudID a string or a number defined in the database ?
    if its a string field then that will blow up in your update
    .
    .
    http://www.HawaiianHope.org
    Providing Technology services to non profit orgs, Homeless Shelters, Food Pantries, Clean And Sober Houses and more.
    To date we have given away over 900 free computers !
    __________________________
    caeli enarrant gloriam Dei !

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    if you use request without specifying form or querystring it will try both....

    I'm not sure what order it tries in (form then querystring or querystring then form) however.

    It can be helpful at times...

  5. #5
    Join Date
    Nov 2005
    Location
    Honolulu HI
    Posts
    119
    wow.
    never knew that.
    .
    .
    http://www.HawaiianHope.org
    Providing Technology services to non profit orgs, Homeless Shelters, Food Pantries, Clean And Sober Houses and more.
    To date we have given away over 900 free computers !
    __________________________
    caeli enarrant gloriam Dei !

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Yeah, it was a few years of developing asp apps before I knew about it either. There are not many places I would use it as it tends to be less efficient then a request.form or request.querystring but it does allow extra flexibility so...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •