Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include an apostrophe in the string passed to DataTable Select()?

The dt.Select(string) gives error missing operand when apostrophe symbol is in the string.

what is the way to solve this error? or How to handle this error?

like image 548
user Avatar asked Feb 05 '11 10:02

user


1 Answers

String value = "Rubens' Home"; // value you want to sanitize and search
dt.Select(String.Format(
    "Location = '{0}'", value.Replace("'", "''")));
like image 130
Rubens Farias Avatar answered Dec 31 '22 18:12

Rubens Farias