int[] ddd = new int[]{27, 28,29};
Select * From ES_Product Where SortID In(" + ddd + ")";
傳入類型不正確
Select * From ES_Product Where SortID In(" + ddd[0] + "," + ddd[1] + "," + ddd[2] + ")";

解决方案 »

  1.   

    int[] ddd = new int[]{27, 28,29};
    Select * From ES_Product Where SortID In(" + ddd + ")";//这里的ddd相当于ddd.ToString(),返回的就是字符串"System.Int32[]"
      

  2.   

    Select * From ES_Product Where SortID In(" + Int32.Parse(ddd[0].ToString()) + "," + Int32.Parse(ddd[1].ToString()) + "," + Int32.Parse(ddd[2].ToString()) + ")";
      

  3.   

    int[] ddd = new int[]{27, 28,29};
    string sTmp = "";
    for(int i=0;i<ddd.Length;i++)
    {
      sTmp += ddd[i].ToString() + ",";
    }
    sTmp = sTmp.SubString(0, sTmp.Length-1);
    sql = "Select * From ES_Product Where SortID In(" + sTmp + ")";
      

  4.   

    对不起,错了。我的SortID的字段的类型是Int的。用这样的方法会导致类型不匹配吧。
      

  5.   

    sql = "Select * From ES_Product Where SortID In(" + sTmp + ")";
    这样只会得到其中的一条记录。