索引1处的绑定值在查询中为空?

时间:2012-04-24 14:45:26

标签: android sqlite

我在以下查询中得到“索引1处的绑定值为空”:

public String searchForWifiSSID(String one, String two){
c = db.query(Constants.TABLE_NAME, new String[]{Constants.PARAM1, Constants.PARAM2}, Constants.PARAM1 + " =? " +" AND " + Constants.PARAM2 + " =? ", new String[]{one,two}, null, null, null);
}

我对selectionArgs的语法是否不正确?这样做是不正确的:

  public String searchForWifiSSID(String one, String two){
    c = db.query(Constants.TABLE_NAME, new String[]{Constants.PARAM1, Constants.PARAM2}, Constants.PARAM1 + " = " + one +" AND " + Constants.PARAM2 + " = " + two, null, null, null, null);
    }

1 个答案:

答案 0 :(得分:6)

确保值“one”和“two”不为NULL。我相信错误意味着其中一个值为空。