I'm trying to get the primary key (ID) created by the following insert:
public void insert (int FK_Vistoria, int CodIrregularidade, int FK_Equipamento, int FK_SubArea) throws SQLException {
String sql = "INSERT OR REPLACE INTO " + DATABASE_TABLE + " VALUES (?, ?, ?, ?);";
SQLiteStatement statement = mDb.compileStatement(sql);
mDb.beginTransaction();
statement.bindLong(1, FK_Vistoria);
statement.bindLong(2, FK_Equipamento);
statement.bindLong(3, CodIrregularidade);
statement.bindLong(4, FK_SubArea);
statement.execute();
mDb.setTransactionSuccessful();
mDb.endTransaction();
}
I tried do get it by using this piece of code:
int idIrregularidade = mDb.insert(idVistoria, idCriterio, idEquipamento, idArea);
Could someone help?
Aucun commentaire:
Enregistrer un commentaire