有谁知道如何使这项工作,我从来没有尝试过,所以我不知道从哪里开始。调用代码很高兴发送两个参数,但查询不满意并要我删除+“AND BeachFK =?”,args2
public String getFacilityDetail(String F_ID, String B_ID) {
String[] args1 = {F_ID};
String[] args2 = {B_ID};
Cursor c = getReadableDatabase().rawQuery("SELECT FacilityDescription FROM BeachFacility WHERE FacilityFK=?", args1 + " AND BeachFK=?", args2);
if(c.moveToNext()){
return(c.getString(c.getColumnIndex("FacilityDescription")));
}
c.close();
return F_ID;
}
任何帮助将不胜感激!
干杯,
麦克
答案 0 :(得分:1)
您有两种方式:
rawQuery("SELECT FacilityDescription FROM BeachFacility WHERE FacilityFK=? AND BeachFK=?",new String[]{F_ID, B_ID});
或:
rawQuery("SELECT FacilityDescription FROM BeachFacility WHERE FacilityFK='" + F_ID + "' AND BeachFK='" + B_ID + "'", null);