Exception "table.... Has No Column Named...."
I am facing a really weird error,while trying to insert into a table called 'my_card'. These are some constants I defined in a separate interface: //tables name public static final
Solution 1:
Your create SQL starts with CREATE TABLE IF NOT EXISTS
. So my idea is you added web column while the device has already had that table. If this is the case then just reinstall the app - it will delete the DB, so you can be sure the table will be created with that column.
Solution 2:
For my case, I forget to insert a empty space for the type, it's like the following erroneous code:
String sql= "CREATE TABLE IF NOT EXISTS " + TABLE_NAME +
" (" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
NAME + " TEXT NOT NULL," +
PHONE + " TEXT NOT NULL,"+
EMAIL + " TEXT NOT NULL,"+
FACEBOOK + "TEXT,"+
WEBSITE + " TEXT,"+
MAJOR + " TEXT NOT NULL,"+
ULINK + " TEXT NOT NULL" + ");" ;
db.execSQL(sql);
the FACEBOOK column will occur an Exception cased by the missing of one empty space. Therefore, in my case, when this sqlite exception happens, you can also check for database table formats.
Post a Comment for "Exception "table.... Has No Column Named....""