txtname.Text.Trim().Replace("'", "' + char(39) + '")
the above statement is not working for stored procedure
txtname.Text.Trim().Replace("'", "' + char(39) + '")
the above statement is not working for stored procedure
You can find a solution here. Theres a guide how to use the Parameters or how to escape the single quote by hand.
Hope this helps..
What are you trying to do? If you want to make the string "safe" for embedding in an SQL query, you might want this instead:
txtname.Text.Trim().Replace("'", "''")
...but I would strongly encourage you to use a parameter instead, if possible. Then you don't need to bother about the single quotes.