请在这里找出问题所在
这里 _id 和 chek 是我的 db i 的列,用于编写查询以搜索具有 id =id 并检查 =number 的那些
public Cursor query(int id){
return myDataBase.query("question", null,"_id = "+id+ "AND " + "chek ="+number,null, null, null, null);
}
请在这里找出问题所在
这里 _id 和 chek 是我的 db i 的列,用于编写查询以搜索具有 id =id 并检查 =number 的那些
public Cursor query(int id){
return myDataBase.query("question", null,"_id = "+id+ "AND " + "chek ="+number,null, null, null, null);
}
愿这对您有所帮助:
用这些行替换您的查询..
public Cursor query(int id){
return myDataBase.query("question", null,"_id = "+id+ " AND " + "chek ="+number,null, null, null, null);
在 And : 中的双引号之间保留空格," And "
否则字符串将为
示例: _id=3And check =9
尝试
return myDataBase.query("question", null,"_id = "+id+ " AND " + "chek ="+number,null, null, null, null);
首先检查你的sql查询语法是否正确
您可以使用原始查询
String SQL= "select * from question where _id = "+id+ " and chek ="+number+";
Log.d("SQL::", SQL);
Cursor cursor = db.rawQuery(SQL, null);
如果尚未解决,请用这些行替换您的查询。
public Cursor query(int id){
return myDataBase.query("question", null,"(_id = "+id+ " AND " + "chek ="+number+")",null, null, null, null);