Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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 June 26th, 2003, 09:12 PM
Authorized User
 
Join Date: Jun 2003
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default How to stop ' stuffing up you code

Hi All,

I have a re occuring problem, usually with SQL statements when either HTML or ' are entered in form fields for updating or adding records to access databases. It breaks up the SQL statement written and causes the SQL to fail. I though i solved this problem by using objRS.AddNew & objRS.Update statements, but still seems to exist on some occasions. I believe this would be a common function and was wondering what solutions you guys use to over come this.

Regards

TDA

TDA
__________________
TDA
 
Old June 26th, 2003, 09:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Basically Tim you need to replace all single quotes(') with two single quotes('').Not double quotes but two singles
strField = replace(strField,"'","''")
This is also important for security so you need to do it with every text field input in your DB from ASP forms.
I also do a replace on "--" with "" to help stop people messing with your db.
I do this in one function

function safeTextField(strIn)
 safeTextField = replace(replace(strIn,"'","''"),"--","")
end function

See Ken Schaefers' web site www.openstatic.com.au for some info into this kind security.
 
Old June 26th, 2003, 09:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Wrong Address for Kens' site
Its is
http://www.adopenstatic.com
The specific article is at
http://www.adopenstatic.com/resource...Validation.asp
 
Old June 26th, 2003, 09:52 PM
Authorized User
 
Join Date: Jun 2003
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to tdaustin Send a message via Yahoo to tdaustin
Default

Thanks for your advice Rod

Its definately an issue i need to fix in my apps

Tim :)



TDA





Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop button won't stop loop JDShaffer Visual Basic 2008 Essentials 3 May 23rd, 2008 03:22 PM
tab stop angelboy C# 2005 1 June 19th, 2007 04:33 AM
Stop watch rohit_ghosh Access VBA 2 May 3rd, 2007 04:14 AM
How to stop user from view js code but still work bekim Javascript How-To 4 January 7th, 2005 09:08 PM
Stop E-mail SannOo Forum and Wrox.com Feedback 7 June 15th, 2004 05:06 PM





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