| Author |
Topic Search Topic Options
|
zkiller
Newbie
Joined: 09 September 2005
Status: Offline
Points: 8
|
Post Options
Thanks(0)
Quote Reply
Topic: problem special characters when submitting to db 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?
Edited by zkiller - 20 January 2006 at 8:42pm
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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
|
|
|
 |
zkiller
Newbie
Joined: 09 September 2005
Status: Offline
Points: 8
|
Post Options
Thanks(0)
Quote Reply
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)
|
Edited by zkiller - 20 January 2006 at 8:42pm
|
 |
zkiller
Newbie
Joined: 09 September 2005
Status: Offline
Points: 8
|
Post Options
Thanks(0)
Quote Reply
Posted: 21 January 2006 at 1:23am |
|
never mind, the problem has been solved.... forgot the ' in the sql query
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |