我将一个int列表传递给Dapper Where IN子句。我收到错误,因为它是逗号分隔的字符串。
JObject step1Form = JObject.Parse(Request.Cookies["step1"]);
IList<int> step1List = step1Form.Root.Select(c => (int)c).ToList();
// "1, 22, 31, 45, 55"
我的int列表是逗号分隔的字符串。
var hazardFormList = dbConnection.Query<FLViewModel>(
"SELECT * FROM FLHA WHERE Id IN (@hazardList) ORDER BY SortOrderId", new { @hazardList = step1List }).ToList();
如何在Dapper查询中传递它?我收到错误,显然是在IN中传递字符串。
有任何帮助吗?