在SQLite数据库中获取新插入数据自增长的ID值
时间:2015-02-26 06:27:42
收藏:0
阅读:616
- SQLiteDatabase db = helper.getWritableDatabase();
- db.execSQL("insert into person(name,phone,amount) values(?,?,?) ",
- new Object[]{person.getName(),person.getPhone(),person.getAmount()});
- Cursor cursor = db.rawQuery("select last_insert_rowid() from person",null);
- int strid;
- if(cursor.moveToFirst())
- strid = cursor.getInt(0);
- Log.i("testAuto", strid+"");
原文:http://www.cnblogs.com/jiangui/p/4300487.html
评论(0)