Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Insert Into using ADO, ASP - ( ' ) sign

Author  Topic 

cbn
Starting Member

11 Posts

Posted - 2002-10-18 : 10:25:15
Hi,
did anyone encountered an error while inserting info into a field in SQL svr with words containing ( ' ) sign?
Lets say:( Cancer Survivor's Journey ) - this string while being inserted gives me an error msg, and all others that use ( ' ). It takes it as being the end of value for the specific field to be inserted.

Is there a fix?
C

monkeybite
Posting Yak Master

152 Posts

Posted - 2002-10-18 : 11:18:04
For every single quote ' in your string, add another ' adjacent to it. This escapes the quote and should fix your problem.

-- monkey

Go to Top of Page

cbn
Starting Member

11 Posts

Posted - 2002-10-18 : 11:40:00
quote:

For every single quote ' in your string, add another ' adjacent to it. This escapes the quote and should fix your problem.

-- monkey





I did that, it does not work.


Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-10-18 : 12:04:28
If your using VB use Replace function.



Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-10-18 : 12:05:17
I use stored procs + ASP/ASP.Net, and I don't run into this issue.

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-10-18 : 12:07:05
Take a look at this as well:

http://www.bann.co.uk/asp/databases/apostrophe.asp

I usually do more things in my makesafe function, like HTMLEncode etc.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

cbn
Starting Member

11 Posts

Posted - 2002-10-18 : 13:56:59
I knew i needed to replace it, but hadnt know the exact syntax for it.

I thank you for input.

Cristian

Go to Top of Page

cbn
Starting Member

11 Posts

Posted - 2002-10-18 : 14:00:51
I knew i needed to replace it, but hadnt know the exact syntax for it.

I thank you for input.

Cristian

Go to Top of Page
   

- Advertisement -