开发者

Search with parameterized in dataset C#?

开发者 https://www.devze.com 2023-03-23 02:38 出处:网络
I have the following code used to search the data in the dataset: DataRow[] fi开发者_StackOverflow中文版lteredRows =

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

精彩评论

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