Home All Groups Group Topic Archive Search About

Apostrophe Problem - HELP

Author
7 Dec 2006 9:27 AM
Mike Fellows
I have a database with a vb.net frot end that I have used forever

recently we upgraded our database server to SQL 2005 x64


in my code i run

mystring= Replace(mystring, "'", "''")

to replace any single apostrophes with 2 apostrophes

in the last couple of weeks its actually started storing 2 apostrophes  in
the database

    e.g Mike's stores into the database as Mike''s

it never did this before and im totally baffelled as to why its happening

any help would be greatly appreciated

Thanks

Mike

Author
7 Dec 2006 11:52 AM
tommaso.gastaldi@uniroma1.it
Are you talking about an INSERT command?

Can you show the code lines where you do that ?

-T

Mike Fellows ha scritto:

Show quoteHide quote
> I have a database with a vb.net frot end that I have used forever
>
> recently we upgraded our database server to SQL 2005 x64
>
>
> in my code i run
>
> mystring= Replace(mystring, "'", "''")
>
> to replace any single apostrophes with 2 apostrophes
>
> in the last couple of weeks its actually started storing 2 apostrophes  in
> the database
>
>     e.g Mike's stores into the database as Mike''s
>
> it never did this before and im totally baffelled as to why its happening
>
> any help would be greatly appreciated
>
> Thanks
>
> Mike
Author
7 Dec 2006 4:27 PM
lord.zoltar
>     e.g Mike's stores into the database as Mike''s
>

How does it look when it comes out of the database, such as using a
SELECT? does a SELECT return "Mike's" or "Mike''s"?
Author
7 Dec 2006 4:28 PM
Oenone
Mike Fellows wrote:
> in the last couple of weeks its actually started storing 2
> apostrophes  in the database

If you're using an INSERT or UPDATE statement, take a look at the SQL you're
actually executing. Make sure the quotes haven't been doubled up twice,
which would result in the behaviour you describe.

If you're putting the values into a DataTable, don't double up the
apostrophes at all -- the DataAdapter object will take care of doing
anything like this that is required for you automatically.

HTH,

--

(O)enone