Surendra Sharma

Surendra Sharma

Search This Blog

Thursday, May 13, 2010

To solve apostrophe problem in where condition of SQL Statement


If ur query contain single apostrophe like this

SELECT * FROM Products WHERE ProductName = 'King's Jalepenos'

Then replace ur single apostrophe with two apostrophe like

SELECT * FROM Products WHERE ProductName ='King''s Jalepenos'



Better do it in C# coding as follows


string

str = "King''s Jalepenos";

str= str.Replace("'","''");

No comments:

Post a Comment