problem special characters when submitting to db
Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Rich Text Editor (RTE)
Forum Description: Support forum for the Web Wiz Rich Text Editor (RTE).
URL: https://forums.webwiz.net/forum_posts.asp?TID=18052
Printed Date: 29 March 2026 at 2:30am Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: problem special characters when submitting to db
Posted By: zkiller
Subject: problem special characters when submitting to db
Date Posted: 19 January 2006 at 11:53pm
i just setup RTE my site and i have into the following problem...
Error Type:
Microsoft JET Database Engine (0x80040E14) Syntax error (missing operator) in query expression 'Tuning-Exe Chip (simular to zombie chip)<br>
MBC @ 16 PSI<br>
Magnaflow Hi-Flow Cat<br>
RAW POWER Stage II Head<br>
Outlaw Engineering Pheno Spacer kit<br>
PRD Plug Wires &'. /RTE/display_form_submission.asp, line 189
|
i tried solving this problem with the following bit of code to no avail...
Public Function CleanQuotes( ByVal strDirty, boolRemove )
strData = Replace( Replace( strDirty, Chr(147), Chr(34) ), Chr(148), Chr(34) )
strData = Replace( Replace( strData, Chr(146), Chr(39) ), Chr(96), Chr(39) )
If Not CBool( boolRemove ) Then
strData = Replace( strData, Chr(39), String( 2, Chr(39) ) )
strData = Replace( strData, Chr(34), Chr(39) & Chr(34) )
ElseIf CBool( boolRemove ) Then
strData = Replace( strData, Chr(39), Chr(32) )
strData = Replace( strData, Chr(34), Chr(32) )
Do While InStr( 1, strData, String( 2, Chr(32) ) ) > 0
strData = Replace( strData, String( 2, Chr(32) ),
Chr(32) )
Loop
End If
CleanQuotes = Trim( strData )
End Function
' to escape for SQL statements
strEditorContent = CleanQuotes(strEditorContent, False)
|
has anyone else run into this problem? if so, how did you solve it?
|
Replies:
Posted By: WebWiz-Bruce
Date Posted: 20 January 2006 at 1:16pm
Try usinmg ADO to update the database instead.
See the Access database tutorial in the ASP Tutirial section of this site to see how ADO updates work
------------- https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting
|
Posted By: zkiller
Date Posted: 20 January 2006 at 7:12pm
-boRg- wrote:
Try usinmg ADO to update the database instead.
See the Access database tutorial in the ASP Tutirial section of this site to see how ADO updates work
|
that is what i am using. *shrug*
here is the code:
this is part an include that is included in the header of all pages threwout the site.
'creating the connection object and opening the database.
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("../write/nmpoc-db.mdb"))
|
and this is the update query that is right below the code that i had posted above.
SQL = "UPDATE user_profile SET " & Session("varEdit") & " = " & strEditorContent & ""
'**this line will write out the SQL statement to the browser. This should help you catch syntax errors.
'Response.Write(SQL)
conn.Execute(SQL)
|
|
Posted By: zkiller
Date Posted: 21 January 2006 at 1:23am
|
never mind, the problem has been solved.... forgot the ' in the sql query
|
Posted By: WebWiz-Bruce
Date Posted: 21 January 2006 at 11:10am
Using ADO to update the database is different to what you are using.
Instead of creating the SQL query, like what you are doing, you use ADO to create the query for you. It then handles stuff like the quotetaion marks.
------------- https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting
|
|