Update driving me crazy

Results 1 to 4 of 4

Thread: Update driving me crazy

  1. #1
    Spud Guest

    Default Update driving me crazy

    Hi all :)<BR><BR>I am having problems with using UPDATE.<BR><BR>I need to update 1 field in my Access DB. <BR><BR>The field is "Status" and the value needs to be set to approve where the PositioID = to the record id I am working with.<BR><BR>I have tried all the ways I know possible to make this work but keep getting error messages.<BR><BR>SQLauth = "UPDATE auth SET Status = Approve WHERE PositionID=" & TRIM(Request.Form("Recid")) (I have passed this in a hidden form)<BR><BR>SQLauth = "UPDATE [auth] SET Status= Approved WHERE PositionID=&#039" & Recid (Have assigned a session variable and assigned it by Recid = Session("bolRecid")<BR><BR>The position id is passed to the new page - but I just cant seem to use it. I get this message:<BR><BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression &#039PositionID=&#039&#039. <BR><BR>If it is usable, could someone please explain to me if I can use the Request.Querystring option?<BR><BR>Thank you kindly for your time :)<BR>Spuddo :)

  2. #2
    Join Date
    Dec 1969

    Default RE: Update driving me crazy

    try this and see if this works:<BR>varid = trim(request("id"))<BR>SQLauth = "UPDATE auth SET Status= &#039Approved&#039 WHERE PositionID=" & varid <BR>------------------------------------

  3. #3
    Spud Guest

    Default RE: Update driving me crazy ARGH!

    Thanks Vinny,<BR><BR>I tried it.. but got this message:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression &#039PositionID=Session(&#039. <BR><BR>/hr/pv/approve.asp, line 11 <BR><BR>As you can see from my code... there is no Session references anywhere on the page..... <BR><BR>Has this happened to anyone else? Am I doing it wrong somewhere else??<BR><BR>Thanks :)<BR><BR><BR>&#060;% <BR> dim actionvar, conn, DSNtemp, SQLauth, recid<BR> Recid = Request.Form("Recid")<BR> IF Actionvar="manapprove" THEN <BR>(line 10) SQLauth = "UPDATE auth SET Status= &#039GM&#039 WHERE PositionID=" & Recid <BR><BR>(line 11) Conn.execute(SQLauth)

  4. #4
    peterjl@austec.net.au Guest

    Default RE: Update driving me crazy ARGH!

    Obviously you would have to create the Connection object before you can use the Execute method. You code snippet does not show this. It woulhave to be done somewhere between the "dim" statement and the "Conn.Execute". See lines I have added to your code. <BR>&#060;% <BR>dim actionvar, conn, DSNtemp, SQLauth, recid<BR>&#039 ------ Create Connection Object ---------<BR>Set Conn=Server.CreateObject("ADODB.Connection")<BR>Co nn.Open "&#060;Your Connection String&#062;"<BR>&#039 -----------------------------------------<BR>Recid = Request.Form("Recid")<BR>IF Actionvar="manapprove" THEN <BR>(line 10) SQLauth = "UPDATE auth SET Status= &#039GM&#039 WHERE PositionID=" & Recid <BR><BR>(line 11) Conn.execute(SQLauth)<BR><BR><BR>"&#060;your connection string&#062;" should be replaced by something like<BR>"Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath("/dbpath/YourDB.mdb") & ";"<BR><BR>Also I think that in your line 11 the parameter "SQLauth" should not have have brackets, as you are using the Execute method as a subroutine call.

Posting Permissions

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