在oracle中,我们使用in方法查询记录的时候,如果in后面的参数个数超过1000个,那么会发生错误,下面的这个方法就是解决这个问题的
测试
string test = "1,2,3,4,5,6,7,8,9,10";
string[] myTest = test.Split(',');
string temp = "";
for (int i = 0; i < myTest.Length; i += 3)
{
for (int j = 0; j < 3; j++)
{
if (i + j < myTest.Length)
{
temp += myTest[i + j] + ",";
}
}
temp = temp.Remove(temp.Length - 1, 1) + ") or id in (";
}
temp = temp + "-1)";