string problems

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

Hi,

I am not sure if this the correct group to ask or not, but here it goes. I
am having problems inserting data into MS SQL 2005 vai c#.

I have strings( varchar( 80 )), that have ' and " in them:

'Danny's Place'

' 1' 1/2" '

How do I get SQL in c# to take varchar with ' & " ?

I have found issues in creating column names with / & % as well. Any ideas?

Thanks,

Jerry
 
Hello jerry,

j> I am not sure if this the correct group to ask or not, but here it
j> goes. I am having problems inserting data into MS SQL 2005 vai c#.
j>
j> I have strings( varchar( 80 )), that have ' and " in them:
j>
j> 'Danny's Place'
j>
j> ' 1' 1/2" '
j>
j> How do I get SQL in c# to take varchar with ' & " ?

use the second ' sign

---
WBR, Michael Nemtsev [C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangel
 
Michael,

Michael Nemtsev said:
Hello jerry,

j> I am not sure if this the correct group to ask or not, but here it
j> goes. I am having problems inserting data into MS SQL 2005 vai c#.
j> j> I have strings( varchar( 80 )), that have ' and " in them:
j> j> 'Danny's Place'
j> j> ' 1' 1/2" '
j> j> How do I get SQL in c# to take varchar with ' & " ?

use the second ' sign

I do not understand, can you give me some examples?

Thank,

Jerry
---
WBR, Michael Nemtsev [C# MVP]. My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
 
Hi,

Use parameters, it will solve your problem as well as prevent SQL Injections
attacks.
 

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

Back
Top