I have checked everything and the creating of the database is fine its when I try to add data to it that it forces the app to close. I cant see why.
db.execSQL("CREATE TABLE IF NOT EXISTS " +
SAMPLE_TABLE_NAME2
+ " (GenID INT, "
+ " Nxtq INT);");
db.execSQL("INSERT INTO " +
SAMPLE_TABLE_NAME2 +
" Values (1,1);");
The error I get output is
Failure 1 (table general has 4 columns but 2 values were supplied) when prepearing ‘INSERT INTO general values (1,1)
There is some stuff before these two query’s here it is in its entirety.
db = this.openOrCreateDatabase(SAMPLE_DB_NAME, MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS " +
SAMPLE_TABLE_NAME +
" (ID INT(3), Questions VARCHAR, Answer1 VARCHAR," +
" Answer2 VARCHAR, Answer3 VARCHAR," +
" Answer4 VARCHAR, CorrectAnswer INT(1), Reason VARCHAR);");
db.execSQL("CREATE TABLE IF NOT EXISTS " +
SAMPLE_TABLE_NAME2
+ " (GenID INT, "
+ " Nxtq INT);");
db.execSQL("INSERT INTO " +
SAMPLE_TABLE_NAME2 +
" Values (1,1);");
try changing the name of “general” to something else like “general_new” and see if the script works, as mentioned, general the table might already exist (even if you don’t think you made it yourself).