473,395 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

format string for html/javascript

hello everyone,

is there a method in .net that will format:

MIKE O'CON"NEL\

to:

MIKE O''CON"NEL\\

so that the data i pull from sql is html/javascript safe

and is there a method that will clean up client input data so i can insert
it into sql
if they client enters an apostrophe ' i have to double it up so it can be
inserted, etc

ty

Nov 29 '05 #1
2 1392
Your best option is to use Server.UrlEncode()when redisplaying entered text
or displaying text with special characters from SQL.

You should look at using SQL parameters within ADO.NET to protect against or
limit SQL Injection attacks (or deal with single quotes). Replacing single
quotes will require that you again change your text at a later time. There
is nothing inherently wrong with a single quote inside of SQL, but you have
to use a method to insert text other than surrounding it with single quotes
which is not a good practice for other reasons above.

--

Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org
"Abraham Andres Luna" <ab*@rdk.com> wrote in message
news:Ok*************@TK2MSFTNGP10.phx.gbl...
hello everyone,

is there a method in .net that will format:

MIKE O'CON"NEL\

to:

MIKE O''CON&quot;NEL\\

so that the data i pull from sql is html/javascript safe

and is there a method that will clean up client input data so i can insert
it into sql
if they client enters an apostrophe ' i have to double it up so it can be
inserted, etc

ty


Nov 29 '05 #2
ty for your answer
Nov 29 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Newbie | last post by:
How would I modify this form to encode *all* the characters in the 'source' textarea to the '%xx' format & place result code into the 'output' textarea? (cross browser compatable) Any help is...
6
by: WindAndWaves | last post by:
Hi Gurus In my quest in putting my first javascript together, I am now trying to conquer something that seems trivial, but has taken me hours. I would like to format a field in a form once the...
2
by: charlie_M | last post by:
I have the following code: <script type=text/javascript> function hide_tooltip(){ var hp = document.getElementById("tooltipper"); hp.style.left=0; hp.style.top=0; hp.style.width=1;...
0
by: GFro | last post by:
I have a calendar page that returns a date to a textbox on the parent page. It is returning the wrong format on the deployment server. On the development server the calendar returns to textbox in...
6
by: marc | last post by:
hi im trying to convert Date() into a unix timestamp so i can stick the result into a mysql db, please help!
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.