Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2004, 01:10 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default issues with apostrophes

Hey,

I'm trying to store a textarea that people can type whatever to a db... it works fine so long as no apostrophes are typed... or if they are typed, you need to put 2 in a row.... Is there any way that I can fixe this, wether it be in the sql statement or otherwise...

query = "INSERT INTO test "
query = query & "(notes) VALUES "
query = query & "('"&Request.Form("notes")&"')"

 
Old December 22nd, 2004, 01:46 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Use Replace function to replace single quotes /apostrophes with two single quotes.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old December 22nd, 2004, 01:50 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Before building the qurery do this ...

strNotes = Request.Form("notes")
If Len(trim(strNotes )) > 0 then
strNotes = Replace(strNotes ,"'","''")
End if

Inside the query use strNotes now. Btw i haven't tested it .. i am just typing it from top of my mind. The logic is surely right .. but just check for any syntax errors :)

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old December 22nd, 2004, 02:42 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 139
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you






Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid truncating field values with apostrophes jrobbins ASP.NET 1.0 and 1.1 Professional 3 December 4th, 2007 08:24 PM
apostrophes or quotation marks crmpicco Javascript 6 March 21st, 2006 09:01 AM
Adding line feeds and apostrophes to a database RiffAff Classic ASP Professional 1 January 21st, 2006 05:40 PM
Inserting apostrophes into an Access Dataabase mrideout BOOK: Beginning ASP.NET 1.0 2 September 10th, 2004 05:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.