The issue you have is that the SQL has a syntax error which is caused by the column definition on Tuesday INTEGER
. ON
is an SQLite keyword so it cannot be a column name unless forced e.g. [on] Tuesday INTEGER
would work (although the column type will be Tuesday INTEGER, which is probably not an issue).
You probably want the column name to be on_Tuesday
so you should change the the SQL to be :-
CREATE TABLE SubjectTable(id INTEGER PRIMARY KEY,subject_name TEXT,on_monday INTEGER,on_tuesday INTEGER,on_wednesday INTEGER,on_thursday INTEGER,on_Friday INTEGER);
To implement this change you will need to ensure that the SQL is run. If the SQL is invoked via the onCreate
method you should note that onCreate
only runs automatically once when the database is created. Typically the way to force ‘onCreate’ to run is to delete the App’s data or uninstall the App. An alternative may be to increase the version number, this requires that the onUpgrade
has been coded so that the onCreate
method will be called.
solved I am getting this error on my code [closed]