开发者

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

开发者 https://www.devze.com 2023-02-09 05:36 出处:网络
The dt.开发者_开发问答Select(string) gives error missing operand when apostrophe symbol is in the string.

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?


String value = "Rubens' Home"; // value you want to sanitize and search
dt.Select(String.Format(
    "Location = '{0}'", value.Replace("'", "''")));
0

精彩评论

暂无评论...
验证码 换一张
取 消