> when inserting data into a Sql Database table if i have a value like
>
[quoted text clipped - 6 lines]
>
> How do i insert such data (without replacing ' with something else)
Using a parameterised update/insert *will* work, and is indeed how you
should do it.
Could you post a short but complete program which demonstrates the
problem (while using parameters)?
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
barry - 28 Mar 2008 08:15 GMT
thanks for your answer.
There was some misunderstanding, SqlParameter does work with singlequotes in
data, i was contructing string like this
"Select * from xxx Where CompanyName='" +sCompanyName+"'"
unfortunately sCompanyName had a singlequote in the data and i was not using
SqlParameter since it is Select statement, generally use it for Update and
Insert statements, i suppose it is better to use SqlParameter as often as
possible.
>> when inserting data into a Sql Database table if i have a value like
>>
[quoted text clipped - 15 lines]
> See http://www.pobox.com/~skeet/csharp/complete.html for details of
> what I mean by that.
Jon Skeet [C# MVP] - 28 Mar 2008 09:23 GMT
> thanks for your answer.
>
[quoted text clipped - 7 lines]
> Insert statements, i suppose it is better to use SqlParameter as often as
> possible.
Absolutely. *Never* put user-provided data directly in SQL statements
unless you're writing a SQL editor :)

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk