即使数据库不为空,光标也始终返回 null。为什么?以及如何解决?谢谢你。
public StatParcours getOneUserInfo(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_USER, new String[] { KEY_USER_ID,
KEY_STUDN , KEY_STUDBD, KEY_TEACHN, KEY_TEACHBD}, KEY_USER_ID + "=?",
new String[] { String.valueOf(id) }, null, null, null, null);
StatParcours stat = null;
if ((cursor!= null)&&(cursor.moveToFirst())){
stat = new StatParcours(
Integer.parseInt(cursor.getString(0)),
cursor.getString(1),
cursor.getString(2),
cursor.getString(3),
cursor.getString(4));
}
return stat ;
}