sql update query,经典asp环境中的语法错误

时间:2022-11-26 01:34:30

I'm getting the following error on the line of code below:

我在下面的代码行中收到以下错误:

Syntax error (missing operator) in query expression 'REPLACE(LTRIM(RTRIM(ATTACHMENTS)), ,'')'.

查询表达式'REPLACE(LTRIM(RTRIM(ATTACHMENTS)),''''中的语法错误(缺少运算符)。

Any help would be awesome...

任何帮助都是极好的...

-----------the line of code that is giving me problems--------------------------------

objConn.Execute("UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = REPLACE(LTRIM(RTRIM(ATTACHMENTS)), "& StoredPath & " ,'') WHERE EMAIL_LETTERS_HOLD_ID= "& AttID & " ")



-----------------------full asp page being called by a function------------------
<%


Dim AttID, RedirectURL
Dim objConn
dim StoredPath

AttID=request("EMAIL_LETTERS_HOLD_ID")
RedirectURL=request("RedirURL")



Set objConn = CreateObject("ADODB.Connection")
objConn.Open "DSN=AccessDSN"
objConn.Execute("UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = REPLACE(LTRIM(RTRIM(ATTACHMENTS)), " & StoredPath & " ,'') WHERE EMAIL_LETTERS_HOLD_ID= "& AttID & " ")
objConn.Close
Set objConn = Nothing

response.redirect RedirectURL
%>

2 个解决方案

#1


I think you're missing some quotes - check before and after the StoredPath variable:

我想你错过了一些引号 - 在StoredPath变量之前和之后检查:

objConn.Execute("UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = REPLACE(LTRIM(RTRIM(ATTACHMENTS)), '"& StoredPath & "' ,'') WHERE EMAIL_LETTERS_HOLD_ID= "& AttID & " ")

objConn.Execute(“UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = REPLACE(LTRIM(RTRIM(ATTACHMENTS)),”&StoredPath&“','')WHERE EMAIL_LETTERS_HOLD_ID =”&AttID&“”)

Andy.

#2


You're missing quotes:

你缺少引号:

xxx" & StoredPath & "'xxx where xxx is a ' - the single quote delimiter.

xxx“&StoredPath&”'xxx其中xxx是' - 单引号分隔符。

#1


I think you're missing some quotes - check before and after the StoredPath variable:

我想你错过了一些引号 - 在StoredPath变量之前和之后检查:

objConn.Execute("UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = REPLACE(LTRIM(RTRIM(ATTACHMENTS)), '"& StoredPath & "' ,'') WHERE EMAIL_LETTERS_HOLD_ID= "& AttID & " ")

objConn.Execute(“UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = REPLACE(LTRIM(RTRIM(ATTACHMENTS)),”&StoredPath&“','')WHERE EMAIL_LETTERS_HOLD_ID =”&AttID&“”)

Andy.

#2


You're missing quotes:

你缺少引号:

xxx" & StoredPath & "'xxx where xxx is a ' - the single quote delimiter.

xxx“&StoredPath&”'xxx其中xxx是' - 单引号分隔符。