jeudi 29 janvier 2015

Insert Method do not insert data neither throws an exception - Android SQLite

One of the methods of my app should set the data into its database. The problem I'm facing is that the insert method (Provided by SQLite Android Class) does not insert any data at the end and it didn't throws an exception either.


Here is the method's code:



public void setGasto(int idRubrica, String estabelecimento, float valor){
SQLiteDatabase db2 = this.getWritableDatabase();
ContentValues values = new ContentValues(4);

values.put("DATA", System.currentTimeMillis());
values.put("VALOR",valor);
values.put("ESTABELECIMENTO", estabelecimento);
values.put("ID_RUBRICA",idRubrica);


db2.beginTransaction();
try{
db2.insertOrThrow("GASTOS",null,values);
} catch (Exception e){
System.out.println(e);
}

db2.endTransaction();
db2.close();

}


I got stuck with it.


Aucun commentaire:

Enregistrer un commentaire