0

请在这里找出问题所在

这里 _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); 


}
4

4 回答 4

1

愿这对您有所帮助:

用这些行替换您的查询..

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

于 2013-07-23T06:51:11.347 回答
0

尝试

return myDataBase.query("question", null,"_id = "+id+ " AND " +  "chek ="+number,null, null, null, null); 
于 2013-07-23T07:01:26.060 回答
0

首先检查你的sql查询语法是否正确

您可以使用原始查询

 String SQL= "select * from question where _id = "+id+ " and chek ="+number+";
    Log.d("SQL::", SQL);
    Cursor cursor = db.rawQuery(SQL, null);
于 2013-07-23T06:57:56.137 回答
0

如果尚未解决,请用这些行替换您的查询。

public Cursor query(int id){
return myDataBase.query("question", null,"(_id = "+id+ " AND " +  "chek ="+number+")",null, null, null, null);
于 2013-07-23T10:13:42.243 回答