StringBuilder ' escape sequence
-
Hi there, Can anyone suggest the best way, or point me in the direction of, escaping or qualifying an ' (apostrophe) character within a StringBuilder? Unsurprisingly, I get a 'Missing operand after' error with the following:
sb = "LastName = 'O'Brien'"
Thanks Jon
-
Hi there, Can anyone suggest the best way, or point me in the direction of, escaping or qualifying an ' (apostrophe) character within a StringBuilder? Unsurprisingly, I get a 'Missing operand after' error with the following:
sb = "LastName = 'O'Brien'"
Thanks Jon
-
StringBuilder sb = new StringBuilder(@"LastName = 'O'Brien'");
Standards are great! Everybody should have one!
Thanks for this Bekjong, Sorry - I forgot to say I am getting the error on this line:
namesBindingSource.Filter = sb.ToString();
Thanks Jon
-
Thanks for this Bekjong, Sorry - I forgot to say I am getting the error on this line:
namesBindingSource.Filter = sb.ToString();
Thanks Jon
-
Thanks for this Bekjong, Sorry - I forgot to say I am getting the error on this line:
namesBindingSource.Filter = sb.ToString();
Thanks Jon
In SQL, you have to prefix single quotes with single quotes. yourQuery = "SELECT * FROM Grades WHERE StudentName = 'Scarlett O ''Hara'"
Cheers, Vikram.
The hands that help are holier than the lips that pray.
-
Thanks Vikram, d@nish, Thanks for the tip Vikram. d@anish - Yes you're right, however I get the error when applied to my
namesBindingSource
Thanks Jon