I'm getting the following error on the line of code below:
Syntax error (missing operator) in query expression '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
%>
From stackoverflow
-
I think you're missing some quotes - check before and after the StoredPath variable:
objConn.Execute("UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = REPLACE(LTRIM(RTRIM(ATTACHMENTS)), '"& StoredPath & "' ,'') WHERE EMAIL_LETTERS_HOLD_ID= "& AttID & " ")
Andy.
MG : cool that worked. but now I'm getting this error: Undefined function 'REPLACE' in expression is REPLACE not a ms sql server function?MG : ok i removed it and i'm still getting syntax errors...it's never ending... objConn.Execute("UPDATE EMAIL_SEND_ATTACHMENTS set ATTACHMENTS = LTRIM(RTRIM(ATTACHMENTS), '"& StoredPath & "' ,'') WHERE EMAIL_LETTERS_HOLD_ID= "& AttID & " ")MG : I've tested my sql statement with replace and it worked fine...storedpath is probably the issue. i've defined it in the main page and made sure it was pulling the right info but there might be a disconnect when i pass it into the function....i'll focus on that now..thanks for the help! -
You're missing quotes:
xxx" & StoredPath & "'xxx where xxx is a ' - the single quote delimiter.
0 comments:
Post a Comment