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

Discussion in 'ASP .Net' started by Eric Layman, Apr 12, 2007.

  1. Eric Layman

    Eric Layman Guest

    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
    Eric Layman, Apr 12, 2007
    #1
    1. Advertising

  2. Eric Layman

    ElmoWatson Guest

    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 news:...
    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
    ElmoWatson, Apr 12, 2007
    #2
    1. Advertising

  3. Eric Layman

    Larry Bud Guest

    On Apr 12, 1:10 pm, "Eric Layman" <namyalcire[at no spam]gmail.com>
    wrote:
    > 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?
    Larry Bud, Apr 12, 2007
    #3
  4. On 12 Apr 2007 12:59:49 -0700, Larry Bud wrote:

    > On Apr 12, 1:10 pm, "Eric Layman" <namyalcire[at no spam]gmail.com>
    > wrote:
    >> 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?


    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
    --
    Bits.Bytes
    http://bytes.thinkersroom.com
    Rad [Visual C# MVP], Apr 14, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sydex
    Replies:
    12
    Views:
    6,428
    Victor Bazarov
    Feb 17, 2005
  2. Replies:
    3
    Views:
    13,101
  3. Evan
    Replies:
    1
    Views:
    376
    Marc 'BlackJack' Rintsch
    Nov 4, 2008
  4. Evan
    Replies:
    3
    Views:
    496
    Marc 'BlackJack' Rintsch
    Nov 4, 2008
  5. vikrant
    Replies:
    8
    Views:
    337
    vikrant
    May 17, 2007
Loading...

Share This Page