Apostrophe Problem - HELP

M

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
 
T

tommaso.gastaldi

Are you talking about an INSERT command?

Can you show the code lines where you do that ?

-T

Mike Fellows ha scritto:
 
L

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"?
 
O

Oenone

Mike said:
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,
 

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

Top