SQLiteConstraintException on inserting values in table
<p>I am new to android development and I have an android database table with following code</p>

<p>public class SoftCopyDatabase extends SQLiteOpenHelper {</p>

<pre><code>private static final String DATABASE_NAME = "SoftCopy.db";
private static final int DATABASE_VERSION = 1;

public SoftCopyDatabase(Context ctx) {
    super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID
            + " INTEGER PRIMARY KEY AUTOINCREMENT, " + SUBJECT
            + " TEXT NOT NULL," + TOPIC + " TEXT NOT NULL, "
            + LECTURENUMBER + " TEXT NOT NULL, " + PAGENUMBER
            + " TEXT NOT NULL, " + DATE + " TEXT NOT NULL, " + _DATA
            + " TEXT NOT NULL);");
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
    onCreate(db);
}} 
</code></pre>

<p>I am trying to add to this table using the method addInfo(), which is as follows:</p>

<pre><code>private void addInfo(){
    ContentValues values = new ContentValues();
    values.put(SUBJECT, SaveData._subject);
    values.put(TOPIC, SaveData._topic);
    values.put(LECTURENUMBER, SaveData._lecturenumber);
    values.put(PAGENUMBER, Integer.toString(PAGE_NUMBER));
    values.put(DATE, SaveData._date);
    values.put(_DATA, SaveData.FILE_NAME + ".png");
    softCopyDB.getWritableDatabase().insertOrThrow(TABLE_NAME, null, values);

}
</code></pre>

<p>But when I increase the value of PAGE_NUMBER( Page_NUMBER is an Integer) while keeping all other entries same and call addInfo(), I receive an error at 
 softCopyDB.getWritableDatabase().insertOrThrow(TABLE_NAME, null, values);</p>

<p>which is as follows</p>

<p>08-21 18:16:11.216: ERROR/AndroidRuntime(329): Caused by: android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed
08-21 18:16:11.216: ERROR/AndroidRuntime(329):     at android.database.sqlite.SQLiteStatement.native_execute(Native Method)
08-21 18:16:11.216: ERROR/AndroidRuntime(329):     at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:55)
08-21 18:16:11.216: ERROR/AndroidRuntime(329):     at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1549)
08-21 18:16:11.216: ERROR/AndroidRuntime(329):     at android.database.sqlite.SQLiteDatabase.insertOrThrow(SQLiteDatabase.java:1432)
08-21 18:16:11.216: ERROR/AndroidRuntime(329):     at neduet.telecom.softcopy.surface.LectureNoting.addInfo(LectureNoting.java:161)</p>

<p>Please help me in sorting this.</p>
