SQL Update Query Error

L

Lisa

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")"
 
M

Mark Schupp

"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
(e-mail address removed)
http://www.ielearning.com
714.637.9480 x17
 
C

Chris Barber

"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.

"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
(e-mail address removed)
http://www.ielearning.com
714.637.9480 x17
 
C

Chris Barber

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

Chris.

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~
 
L

Lisa

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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top