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)
精彩评论