Solved

' interrupts string input

Posted on 1998-07-27
4
190 Views
Last Modified: 2011-09-20
In a web application (uses ASP), users are asked to answer a question through a multiple-line input box. When using the ' char, as in "I'm", the input following to that gets ignored when storing the data in the database. I know the cause - but how can I prevent it from occuring?
0
Comment
Question by:ribbegrd
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
connex earned 100 total points
ID: 1089231
Just put the String you send to the SQL-Server in "<string>"
This should solve that.

0
 

Author Comment

by:ribbegrd
ID: 1089232
How exactly should this be done? My app reads stuff off a form, and then directly inserts it. Where should the <string> tag be?
0
 
LVL 2

Expert Comment

by:connex
ID: 1089233
depends on how you construct the statement. Maybe email me some
sample code and I can send you back a version that does is.
My Email is us@datapec.datagroup.de

0
 
LVL 28

Expert Comment

by:sybe
ID: 1089234
using the Replace function replace the ' with 2x '

REPLACE(Request.Form("field_whatever"), "'", "''")

But you can also URLEncode the string and URLDecode it back when you get the data from the database.

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question