使用last_insert_rowid()函数
- 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 + "");
- @H_301_9@