Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying appostrophies when entered in DB/Sql statement?

Status
Not open for further replies.

Ovatvvon

Programmer
Feb 1, 2001
1,514
US
I made a message board, and it pulls the message from an access database. However, whenever someone writes an appostrophie ( ' ) in the textbox or textarea, it comes up the the error:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''This consist's of multiple tests', '4/16/01 10:34:18 PM' );'.


But it works with quote marks fine.

I noticed that tek-tips.com here doesn't have a problem displaying appostrophies ( ' ) or any other symbols for that matter...

Does anyone know why, or how I can accomplish the same thing with my message board?

Thank you!
-Ovatvvon
 
Here you go bud, I use this function to fix that problem
<%
RemoveCharacters()
dim frm,item
Set frm = Server.CreateObject(&quot;Scripting.Dictionary&quot;)
frm.CompareMode=1
For each Item in Request.Form
frm.Add Cstr(item), Replace(Request.Form(item),&quot;'&quot;,&quot;''&quot;)
Next
Set RemoveCharacters = frm
End Function
%>

<%
dim myform
Set myform = RemoveCharacters()
'Response.Write myform(&quot;comments&quot;) 'I just write them to the screen to see if it works

Then on my inputscript from the form I simply use it on the field I want to function to work as follows:

'&quot;& myform(&quot;comments&quot;)& &quot;', &quot;&_
%>
Cool?
Hope it helps man




Tony
(-:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top