Salmaan Salmaan - 10 months ago 94
Android Question

Sqlite database InsertOrThrow line not executed giving FATAL EXCEPTION - Android

This is my database method to insert data in it...
It was working fine and suddenly, out of nowhere it started giving FATAL EXCEPTION

public boolean insertReport(String name, String title, String date, String status) {

try {
ContentValues cv = new ContentValues();
cv.put("name", name);
cv.put("elabel_title", title);
cv.put("date", date);
cv.put("status", status);

db.insertOrThrow("savedreports", null, cv);
} catch (SQLiteConstraintException e) {
return false;
} finally {
return true;

I debugged it using breakpoints,
All going good but after execution of
cv.put("status", status);
line it jumps directly to the
block :/

Not executing the insertOrThrow...

What am i doing wrong???


I don't know why people throw down votes, even though I have the same issue and this is the simple solution in my perspective.

"status" column surely not exist in your database column,please just check.

Problem is on this line

cv.put("status", status); 

Might be You did not add this "status" column into your database. Because it don't find any status column so it jumps out.