Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - problem special characters when submitting to db
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum Lockedproblem special characters when submitting to db

 Post Reply Post Reply
Author
zkiller View Drop Down
Newbie
Newbie


Joined: 09 September 2005
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote zkiller Quote  Post ReplyReply Direct Link To This Post 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...
Quote 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 &amp'.
/RTE/display_form_submission.asp, line 189

i tried solving this problem with the following bit of code to no avail...
Quote
    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
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zkiller View Drop Down
Newbie
Newbie


Joined: 09 September 2005
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote zkiller Quote  Post ReplyReply Direct Link To This Post Posted: 20 January 2006 at 7:12pm
Originally posted by -boRg- -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.
Quote '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.
Quote
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
Back to Top
zkiller View Drop Down
Newbie
Newbie


Joined: 09 September 2005
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote zkiller Quote  Post ReplyReply Direct Link To This Post Posted: 21 January 2006 at 1:23am
never mind, the problem has been solved.... forgot the ' in the sql query
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.