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

会有一股神秘感。 提交于 2020-01-30 04:46:29

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/4906384/how-do-i-include-an-apostrophe-in-the-string-passed-to-datatable-select

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!