从SQLite获取价值

时间:2015-03-06 00:51:10

标签: sqlite

我的SQLite数据库中有一个表:

表名:用户

____________________________________
|IdUser(PK)|User    | Tags |Password|
|20        |Gabriel |Low   |Cat123  |

我需要Eclipse / Android的字符串中的值“标签”

我有一个选择查询:

SELECT * FROM Users WHERE UserID = 20 ORDER BY UserID DESC LIMIT 1;

1 个答案:

答案 0 :(得分:0)

你应该操作这样的东西

Cursor c = mDB.rawQuery("SELECT * FROM Users WHERE IdUser = 20 ORDER BY IdUser", null);

while (c.moveToNext()) {
     //Sample operation with the Database
     if (c.getString(c.getColumnIndex("IdUser"))!=null) { 
           //Do something 
     }
}

c.close();