SQL Update Query Error

Discussion in 'ASP General' started by Lisa, Jul 24, 2003.

  1. Lisa

    Lisa Guest

    can someone tell me what is wrong with this query? I've tried every
    combo that I can think of - adding &,"", "'", ) everywhere I can think
    of and I keep getting an 'Expected end of statement error????

    This is the query:
    strSql = "UPDATE DE_change SET "
    DE_change.BunName = "'" & Trim(Request.Form("txtBUN")) & "', " & _
    DE_change.OwnerName = "'" & Trim(Request.Form("txtOwnerName")) & "', "
    & _
    DE_change.Manager = "'" & Trim(Request.Form("txtManager")) & "', " & _
    DE_change.CCM = "'" & Trim(Request.Form("txtCCM")) & "', " & _
    DE_change.LoadDate = "'" & Trim(Request.Form("txtLoadDate")) & "', " &
    _
    DE_change.ProdDate = "'" & Trim(Request.Form("txtProdDate")) & "', " &
    _
    DE_change.SubmissionDate = "'" & Trim(Request.Form("txtSubmitDate")) &
    "', " & _
    WHERE DE_change.load_id = Request.QueryString("LoadID")"

    cnConnection.Execute(strSQL)

    this is the error:
    Error Type:
    Microsoft VBScript compilation (0x800A0401)
    Expected end of statement
    /Project2/Update_change.asp, line 22, column 6
    WHERE DE_change.load_id = Request.QueryString("LoadID")"
    Lisa, Jul 24, 2003
    #1
    1. Advertising

  2. Lisa

    Mark Schupp Guest

    "WHERE DE_change.load_id = "n & Request.QueryString("LoadID")

    Try writing out the sql statement before running it to see what you are
    actually sending to the dbms.

    --
    Mark Schupp
    --
    Head of Development
    Integrity eLearning
    Online Learning Solutions Provider

    http://www.ielearning.com
    714.637.9480 x17


    "Lisa" <> wrote in message
    news:...
    > can someone tell me what is wrong with this query? I've tried every
    > combo that I can think of - adding &,"", "'", ) everywhere I can think
    > of and I keep getting an 'Expected end of statement error????
    >
    > This is the query:
    > strSql = "UPDATE DE_change SET "
    > DE_change.BunName = "'" & Trim(Request.Form("txtBUN")) & "', " & _
    > DE_change.OwnerName = "'" & Trim(Request.Form("txtOwnerName")) & "', "
    > & _
    > DE_change.Manager = "'" & Trim(Request.Form("txtManager")) & "', " & _
    > DE_change.CCM = "'" & Trim(Request.Form("txtCCM")) & "', " & _
    > DE_change.LoadDate = "'" & Trim(Request.Form("txtLoadDate")) & "', " &
    > _
    > DE_change.ProdDate = "'" & Trim(Request.Form("txtProdDate")) & "', " &
    > _
    > DE_change.SubmissionDate = "'" & Trim(Request.Form("txtSubmitDate")) &
    > "', " & _
    > WHERE DE_change.load_id = Request.QueryString("LoadID")"
    >
    > cnConnection.Execute(strSQL)
    >
    > this is the error:
    > Error Type:
    > Microsoft VBScript compilation (0x800A0401)
    > Expected end of statement
    > /Project2/Update_change.asp, line 22, column 6
    > WHERE DE_change.load_id = Request.QueryString("LoadID")"
    Mark Schupp, Jul 24, 2003
    #2
    1. Advertising

  3. Lisa

    Chris Barber Guest

    "WHERE DE_change.load_id = "n & Request.QueryString("LoadID")

    That won't work? [see the 'n' after the closing double-quote] I presume it
    was a typo in the post and the intent was:

    "WHERE DE_change.load_id = " & Request.QueryString("LoadID")

    Chris.

    "Mark Schupp" <> wrote in message
    news:...
    "WHERE DE_change.load_id = "n & Request.QueryString("LoadID")

    Try writing out the sql statement before running it to see what you are
    actually sending to the dbms.

    --
    Mark Schupp
    --
    Head of Development
    Integrity eLearning
    Online Learning Solutions Provider

    http://www.ielearning.com
    714.637.9480 x17


    "Lisa" <> wrote in message
    news:...
    > can someone tell me what is wrong with this query? I've tried every
    > combo that I can think of - adding &,"", "'", ) everywhere I can think
    > of and I keep getting an 'Expected end of statement error????
    >
    > This is the query:
    > strSql = "UPDATE DE_change SET "
    > DE_change.BunName = "'" & Trim(Request.Form("txtBUN")) & "', " & _
    > DE_change.OwnerName = "'" & Trim(Request.Form("txtOwnerName")) & "', "
    > & _
    > DE_change.Manager = "'" & Trim(Request.Form("txtManager")) & "', " & _
    > DE_change.CCM = "'" & Trim(Request.Form("txtCCM")) & "', " & _
    > DE_change.LoadDate = "'" & Trim(Request.Form("txtLoadDate")) & "', " &
    > _
    > DE_change.ProdDate = "'" & Trim(Request.Form("txtProdDate")) & "', " &
    > _
    > DE_change.SubmissionDate = "'" & Trim(Request.Form("txtSubmitDate")) &
    > "', " & _
    > WHERE DE_change.load_id = Request.QueryString("LoadID")"
    >
    > cnConnection.Execute(strSQL)
    >
    > this is the error:
    > Error Type:
    > Microsoft VBScript compilation (0x800A0401)
    > Expected end of statement
    > /Project2/Update_change.asp, line 22, column 6
    > WHERE DE_change.load_id = Request.QueryString("LoadID")"
    Chris Barber, Jul 25, 2003
    #3
  4. Lisa

    Chris Barber Guest

    Can you post what the final 'constructed' SQL statement looks like (eg. do a
    response.write or get it ion debug mode)?

    Chris.

    "Lisa" <> wrote in message
    news:...
    I've tried all your suggestions before I posted my message (adding & _
    after the SET, adding '&' before and after the Query String, adding
    ["'" Trim(Request.Querystring("LoadID")) & "')"] - I'm at a loss as to
    why I keep getting the error........confused?

    ~L~
    Chris Barber, Jul 25, 2003
    #4
  5. Lisa

    Lisa Guest

    Chris,
    Sorry it took so long to respond... I've been away - I ended up
    figuring out the problem and this is the code that worked....I was
    missing my double quotes at the begining of the string

    strSql = "UPDATE DE_change SET BunName = '" &
    Trim(Request.Form("txtBUN")) & "', " & _
    "OwnerName = '" & Trim(Request.Form("txtOwnerName")) & "', " & _
    "Manager = '" & Trim(Request.Form("txtManager")) & "', " & _
    "CCM = '" & Trim(Request.Form("txtCCM")) & "', " & _
    "LoadDate ='" & Trim(Request.Form("txtLoadDate")) & "', " & _
    "ProdDate ='" & Trim(Request.Form("txtProdDate")) & "', " & _
    "SubmissionDate ='" & Trim(Request.Form("txtSubmitDate")) & "' " & _
    "WHERE load_id = " & Request.QueryString("LoadID")

    cnConnection.Execute(strSQL)

    "Chris Barber" <> wrote in message news:<#>...
    > Can you post what the final 'constructed' SQL statement looks like (eg. do a
    > response.write or get it ion debug mode)?
    >
    Lisa, Aug 19, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anonymous
    Replies:
    0
    Views:
    1,439
    Anonymous
    Oct 13, 2005
  2. sanju
    Replies:
    0
    Views:
    372
    sanju
    Dec 18, 2006
  3. WuBin
    Replies:
    2
    Views:
    783
    Jeff Dillon
    Aug 21, 2008
  4. David Shorthouse

    Update query doesn't update table

    David Shorthouse, Jun 17, 2005, in forum: ASP General
    Replies:
    6
    Views:
    245
    David Shorthouse
    Jun 17, 2005
  5. Nano

    SQL UPDATE Query in ASP

    Nano, Nov 12, 2007, in forum: ASP General
    Replies:
    6
    Views:
    185
Loading...

Share This Page