jeudi 6 août 2015

SQLiteConstraintException constraint failed

hello guys i'm having this exception whenever i try to insert to the clients table. this is the client table:

db.execSQL("CREATE TABLE " + TABLE_CLIENTS + " (" +
                COLUMN_CID + " INTEGER PRIMARY KEY, " +
                COLUMN_CLIENTNAME + " TEXT, " + COLUMN_ADDRESS + " TEXT, " + COLUMN_LOANAMOUNT + " DECIMAL)");

this is the insertion method public long addClients(Client c) {

    ContentValues cv = new ContentValues();
    cv.put(COLUMN_CID, c.getCId());
    cv.put(COLUMN_CLIENTNAME, c.getCName());
    cv.put(COLUMN_ADDRESS, c.getAddress());
    cv.put(COLUMN_LOANAMOUNT, c.getLoanamount());

    return ourDatabase.insert(TABLE_CLIENTS, null, cv);
}

Note that the object is being read in the logcat just fine, all the attributes are correct. so i hope you can help me

Aucun commentaire:

Enregistrer un commentaire