第一頁 返回 繼續 最後一頁 摘要 圖形
使用資料庫(一)
SQLiteDatabase db=SQLiteDatabase.openOrCreateDatabase(dbfile,null);
執行SQL指令:有回傳值用rawQuery(),無回傳值用execSQL()
String str="select id,name,tel,addr,x from main order by id;";
cursor = db.rawQuery(str, null);
有回傳值就用cursor(游標)管理
- cursor.getCount() 資料筆數
- cursor.moveToFirst()到第一筆
- cursor.moveToNext() 到下一筆
- cursor.moveToPosition(int x) 到第x筆