-----Original Message-----
Or use ' as the delimiter.
Firstly my apoligies, I made a mistake in my original post
as its single quotes I've been having problems with, not
double quotes as suggested.
The database I'm using is Access. I've read your article
on ASPFAQ about the perils of using Access. But I needed
to get this site up quickly, and because its an internal
site with very few users Access was a suitable choice.
This is the ASP script I'm using to update the database:
strComments = Request.Form("comments")
sql = "UPDATE vehicles SET vehicles.comments = '" & _
strComments & _
"' WHERE vehicles.key = " & Session("key")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open Session("connectionString")
conn.execute sql, , &H00000080
If type in this quote (for example):
Two canibals are eating a clown, one turns to the other
and says 'does this taste funny to you?'
My ASP code generates this SQL:
UPDATE vehicles SET vehicles.comments = 'Two canibals
are eating a clown, one turns to the other and
says 'does this taste funny to you?'' WHERE vehicles.key
= 1803
Which causes this error when executed:
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query
expression ''Two canibals are eating a clown, one turns
to the other and says 'does this taste funny to you?'''.
/ovms2/comments_update_execute.asp, line 36
Which is why I've been removing the single quotes with a
regular expression (I wasn't ware of the replace
command). The
http://www.aspfaq.com/show.asp?id=2035
method you posted doesn't seem to work either. I've
modified the code to look like this:
sql = replace(sql,"'","''")
And now get this SQL returned:
UPDATE vehicles SET vehicles.comments = ''Two canibals
are eating a clown, one turns to the other and
says ''does this taste funny to you''?'' WHERE
vehicles.key = 1803
And this error when it executes:
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query
expression '''Two canibals are eating a clown'.
/ovms2/comments_update_execute.asp, line 37
Shouldn't this have worked? I really can see why its
failing.
TA,
Colin