Datagrid on load; replace all double single quote to single quote to display to user

E

Eric Layman

Hi,

I've saved data into the db by doing a replace() on single quote.

Right now on data display on a datagrid, it shows double single quote.

How do I make changes during run time of datagrid so that the double single quote will be replaced as single quote?

Pls advise.

Thanks
 
E

ElmoWatson

Your best bet, especially to prevent SQL injection attacks, instead, would be to use Parameterized Queries.
Here's a 2 part tutorial on that subject:
http://aspnet101.com/aspnet101/tutorials.aspx?id=1

David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com


"Eric Layman" <namyalcire[at no spam]gmail.com> wrote in message Hi,

I've saved data into the db by doing a replace() on single quote.

Right now on data display on a datagrid, it shows double single quote.

How do I make changes during run time of datagrid so that the double single quote will be replaced as single quote?

Pls advise.

Thanks
 
L

Larry Bud

Hi,

I've saved data into the db by doing a replace() on single quote.

Right now on data display on a datagrid, it shows double single quote.

How do I make changes during run time of datagrid so that the double single quote will be replaced as single quote?

Are you saying the datagrid is converting a single quote from the
database two 2 single quotes?
 
R

Rad [Visual C# MVP]

Are you saying the datagrid is converting a single quote from the
database two 2 single quotes?

If the database stored a double quote then your code to save is the
culprit. Are you by any chance using parameterize queries for the insert?
If you are then there is no need to do the replace as parameters are smart
enough to handle single quotes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top