Re: What Did I Miss Here?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jared (_at_vb_newsgroups@hotmail.com)
Date: 09/11/04

  • Next message: Michael D. Long: "Re: Newbie: Light-weight database for a C# client app? MSDE?"
    Date: Sat, 11 Sep 2004 14:15:26 -0500
    
    

    Is the Use Quoted Identifiers option checked in your database property sheet
    under the Options tab?

    "Wayne Wengert" <wayneDONTWANTSPAM@wengert.com> wrote in message
    news:O4IcLHDmEHA.2412@TK2MSFTNGP10.phx.gbl...
    > In the database it is being stored as two single quotes. I've verified
    > that
    > I really am typing two single quotes and when I run your sample in QA it
    > works as expected (it's a boy it's a girl)
    >
    > I've used this replace method many times in ASP and it has always worked
    > fine. I am wondering if there is something special in .NET?
    >
    > Wayne
    >
    > "Jared" <@vb_newsgroups@hotmail.com> wrote in message
    > news:10k6fgrthqggp00@corp.supernews.com...
    >> In the database is it stored with two single quotes '' or one double
    >> quote
    >> "? Could you have mistyped the replacement string? All the documentation
    >> I've found supports your method. Could it have something to do with your
    >> colation?
    >> If you paste this block into query analyzer what does it produce?
    >>
    >> CREATE TABLE #MyTable (
    >> Col1 varchar(25),
    >> Col2 varchar(25))
    >>
    >> INSERT INTO #MyTable VALUES('it''s a boy', 'it''s a girl')
    >> SELECT * FROM #MyTable
    >> DROP TABLE #MyTable
    >>
    >> "Wayne Wengert" <wayneDONTWANTSPAM@wengert.com> wrote in message
    >> news:uqdTa4BmEHA.324@TK2MSFTNGP11.phx.gbl...
    >> > Jared;
    >> >
    >> > Thanks for the reply. If I don't use the replace function the sql
    >> > statement
    >> > blows up!
    >> >
    >> > Wayne
    >> >
    >> > "Jared" <@vb_newsgroups@hotmail.com> wrote in message
    >> > news:10k67te4rs5ku66@corp.supernews.com...
    >> >> Have you tried to execute your function without replacing your quotes?
    >> > Does
    >> >> it produce the results you want? Is possible that your dataadapter or
    >> >> whatever you are using escapes this char for you? I know the
    > xmldocument
    >> >> object does this intrinsically.
    >> >>
    >> >> obj.innerText = "Amos & Andrew"
    >> >> - Produces -
    >> >> <obj>Amos &amp; Andrew</obj>
    >> >>
    >> >>
    >> >> "Wayne Wengert" <wayneDONTWANTSPAM@wengert.com> wrote in message
    >> >> news:eO3j0OBmEHA.712@TK2MSFTNGP09.phx.gbl...
    >> >> >I am using VB.NET connected to an SQL 2000 server and I want to save
    >> >> >some
    >> >> > text fields from a form to string fields in a table. The text might
    >> >> > include
    >> >> > some single quotes so in my update command I am replacing single
    > quotes
    >> >> > with
    >> >> > two single quotes so that the update query works. (see piece of
    >> > statement
    >> >> > below)
    >> >> >
    >> >> > My problem is that when I look at what really gets stored in the
    > table,
    >> >> > all
    >> >> > single quotes are now doubled such as:
    >> >> >
    >> >> > Text Value = Joe's
    >> >> > Stored in table = Joe''s
    >> >> >
    >> >> > What am I missing here?
    >> >> >
    >> >> >
    >> >> > ============ Segment of SQL statement =============
    >> >> >
    >> >> >
    >> >> > Update UnitShowInfo Set ShowName = '" & Replace(txtShowName.Text,
    > "'",
    >> >> > "''")
    >> >> > & "',.....
    >> >> >
    >> >> >
    >> >>
    >> >>
    >> >
    >> >
    >>
    >>
    >
    >


  • Next message: Michael D. Long: "Re: Newbie: Light-weight database for a C# client app? MSDE?"

    Relevant Pages

    • Possible "bug" found in gnatcoll-sql_impl.adb
      ... I end up with more characters than I've bargained for. ... I end up with Peter in the database. ... extra single quotes added to all my string data. ...
      (comp.lang.ada)
    • Re: Syntax error (missing operator) in query expression
      ... > and how to use single quotes and double quotes in ASP? ... expression to "scrub" the search term prior to constructing the SQL ... query depending on your database environment) instead of dynamically ... constructing the SQL statement. ...
      (microsoft.public.inetserver.asp.general)
    • Re: SQL Injection
      ... Make sure you always escape single quotes and other magic characters when ... you enter data into your database. ...
      (borland.public.delphi.non-technical)
    • Re: Need a Strategy to store the Single Quotes in the Database
      ... >> Database where if i try to Store the String value with Single Quotes ... >> then it is throwing the error as SQL String Truncated. ...
      (microsoft.public.dotnet.languages.vb)