80,354
社区成员
发帖
与我相关
我的任务
分享
/**
* 查询数据集
* @param id, 自增的那个id
* @return 数据内容
*/
public String queryId(int id) {
synchronized (OBJ_LOCK) {
String content = "";
//???
String[] columns = {"content"};
String selection = "id=?";
String[] whereArgs = {id+""};
SQLiteDatabase db = null;
Cursor cursor = null;
db = getWritableDatabase();
try {
cursor = db.query(s_tableName, columns, selection, whereArgs, null, null, null);
if (cursor != null) {
cursor.moveToFirst();
content = cursor.getString(3);
String datatime = cursor.getString(4);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
close();
}
return content;
}
}