我有一个名为<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://stuk.github.io/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="http://stuk.github.io/jszip-utils/dist/jszip-utils.js"></script>
<script type="text/javascript" src="http://stuk.github.io/jszip/vendor/FileSaver.js"></script>
<input type="file" class="hide load">
<a class="trigload" href="javascript:void(0)">Load Image</a>
<a class="download fr" href="javascript:void(0)">Download</a>
<div class="logo"></div>
<div class="fill" align="center">
<canvas class="holder" width="128" height="128"></canvas>
</div>
的表,主键为foods
,插入后为food_id
db.insert()integer primary key autoincrement. Now i know that
food_id returns id (-1 if insertion failed) but the question is if this is the same id as
food_id`,因为我我正在列表和应用范围中保存食品项目。
答案 0 :(得分:1)
请试试这个 -
//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();