开发者

Search with parameterized in dataset C#?

I have the following code used to search the data in the dataset:

DataRow[] fi开发者_StackOverflow中文版lteredRows =
                        myDS
                         .Tables["Inventory"]
                         .Select(string.Format("Make LIKE '%{0}%'", keyword));

however, if the keyword contains data such as O'Henry then above command will failed. I can get over this with parameterized with SQLCommand. But I have no idea how to use parameterized with dataset.

Any idea, please?


You need to replace ' with ''. (two single-quote characters)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜