jeudi 2 avril 2015

SQLite return -1 in android

i am working with SQLite in android and i am facing a problem. can anybody tell me that following method return -1 why ?



public long addNamazTime(Namaz namaz)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
Log.d("Tag", "Date: "+namaz.getDate());
values.put(KEY_DATE, namaz.getDate());

Log.d("Tag", "Fajar"+ namaz.getFajar());
values.put(KEY_FAJAR, namaz.getFajar());

Log.d("Tag", "Zohr: "+namaz.getDhuhr());
values.put(KEY_DHUHR, namaz.getDhuhr());

Log.d("Tag", "Asar: "+namaz.getAsar());
values.put(KEY_ASAR, namaz.getAsar());

Log.d("Tag", "Maghrib: "+namaz.getMaghrib());
values.put(KEY_MAGHRIB, namaz.getMaghrib());

Log.d("Tag", "Isha: "+namaz.getIsha());
values.put(KEY_ISHA, namaz.getIsha());

// Inserting Row
long id = db.insert(TABLE_NAME, null, values);
return id;
}

Aucun commentaire:

Enregistrer un commentaire