开发者

How to get selected values from database

I want only selected values form database depends upon i and j?

public Cursor getAll() {
         int i=2;j=1;  
           return (getReadableDatabase().rawQuery(
                    开发者_运维知识库    "SELECT _id,note,answer From Notes where _id=? AND note=?",new String[]{i+""},new String[]{j+""}));
        }


Try this.

public Cursor getAll() {
   int i=2;
   return (getReadableDatabase().rawQuery(
                "SELECT _id,note,answer From Notes where _id=? ",new String[]{i+""}));
}

For multiple arguments...

public Cursor getAll() {
     int i=2;j=1;  
       return (getReadableDatabase().rawQuery(
                    "SELECT _id,note,answer From Notes where _id=? AND note=?",new String[]{i+"", j+""}));
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜