我在c#中有一个适配器,我想知道值(int类型)是否在值列表中。我该怎么做?当我做send IN @sendList
它给我一个错误。我尝试使用LIKE
这样的@sendList LIKE '%'+ send +'%'
但是适配器无法从int转换为varchar ......
答案 0 :(得分:0)
最简单的方法是拆分ID列表:
...
string.Format("Send IN {0}", string.Join(sendList.Select(id => id.ToString()));
但是如果你坚持使用参数,你可以编写一个将列表转换为字符串的SQL函数。您可以找到许多示例(like this)over the web。