Re: handling single quotes??

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Scott M. (s-mar_at_nospam.nospam)
Date: 06/02/04


Date: Tue, 1 Jun 2004 22:09:19 -0400

That won't cut it in .NET. It will be seen as two strings next to each
other without any concatenation.

"Dan Brussee" <dbrussee@nc.rr.com> wrote in message
news:qr3qb0hd638u9m6hd4ve79gganj83nmhp0@4ax.com...
> At least with SQL Server, it recognizes two single quotes as a single
> quote inside single quote delimiters. Huh??
>
> select * from table where name = 'Bob''s mini mart'
>
> Notice two single quotes between b and s of Bob's. Use a replace
> method to get it that way.
>
>
> On Tue, 1 Jun 2004 19:05:36 -0400, "Scott M." <s-mar@nospam.nospam>
> wrote:
>
> >try inserting the char code. I believe it's 39 - - CHR(39)
> >
> >
> >"SStory" <TheStorys@TAKEOUTTHISSPAMBUSTERsofthome.net> wrote in message
> >news:OQhUzsCSEHA.2936@TK2MSFTNGP12.phx.gbl...
> >> How can I handle the user entering single quotes like in
> >>
> >> Bob's mini mart?
> >>
> >> If I use command objects will this no longer be an issue?
> >>
> >> I guess that would mean no simple adhoc SQL statements right?
> >>
> >> like SELECT name from WHATEVER
> >>
> >> would need a command object with
> >>
> >> "SELECT @NAME, etc.
> >> and then params
> >>
> >> is this the way to solve the problem?
> >>
> >> Thanks,
> >>
> >> Shane
> >>
> >>
> >
>



Relevant Pages

  • Re: concat vs variable in string
    ... Or does it still do a concatenation behind the scenes? ... If you use single quotes instead of double, ... massive strings or a long loop. ... to be wrapped in double quoted strings, ...
    (comp.lang.php)
  • Re: Dynamic directory handles?
    ... Cost to develop code that saves those cycles: ... I use single quotes unless I require one of the two extra ... Some strings contain variables, some strings don't. ...
    (comp.lang.perl.misc)
  • Re: [PHP] Re: optimilize web page loading
    ... >>> doubles for the email. ... because the strings are not concatenated before output. ... adapting to using echo (to the ob to avaoid printing forty ... So, it looks like for echoing at least then single quotes are actually marginally slower than double quotes, and interpolation is faster. ...
    (php.general)
  • Re: Handling Strings in SQL server
    ... First, if your application has problems with the "O'Malley" issue (imbedded single quotes in strings), you need to address the problem at the root. ... Consider than if your code permits users to enter strings with embedded single quotes, they can also introduce SQL injection attacks. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to deal with "{" in system("...command..."); ?
    ... I want to replace all strings of one blank followed by 8 dots ... You could use single quotes instead of double quotes, ... There's perhaps a better and shorter format of this command. ...
    (comp.lang.perl.modules)