I have a string
good overview of ESP's in more detail than you probably need
.
While inserting into SQL table it is giving error. So I want replace apostrophe in the string with double apostrophe like
good overview of ESP''s in more detail than you probably need
How to manipulate this in c#?
Very easy:
string s = "good overview of ESP's in more detail than you probably need.";
string escaped = s.Replace("'","''");
Note: It is usually safer to use command parameters. Especially if the values of the input strings are not controlled by your code (i.e. user entries).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With