請嘗試這個 -
//local database variables
private DataSourceUserRecords dataResource ;
private SQLiteDatabase _database = null;
private Cursor _cursor = null;
private MySqliteHelper DBHelper;
中的onCreate添加該代碼或要打電話。
DBHelper = new MySqliteHelper(UploadImgService.this);
_database = DBHelper.getWritableDatabase();
dataResource = new DataSourceUserRecords(UploadImgService.this);
dataResource.open();
_cursor = _database.rawQuery("select * from "+MySqliteHelper.TABLE_NAME, null);
_cursor.moveToFirst();
while(_cursor.isAfterLast() == false){
String _food_id = _cursor.getInt(_cursor.getColumnIndex(MySqliteHelper.YOUR_COLUMN_ID));
System.out.println("Food ID from db : " + _food_id);
_cursor.moveToNext();
}
_cursor.close();
所以,你需要獲取該food_id價值? –
是的確切:-) –
請看看我的答案。 –