this is my error in console :
11-29 19:06:50.295: E/AndroidRuntime(333): android.database.sqlite.SQLiteException: table usuarios has no column named email: ,
This problem occurs mostly when you make a change in the database but do not delete the previous database. Uninstall the app and then run it.
Uninstall the app, and again install it, because it can be solve by using two approaches, one by using
alter method and increment version
or
creating the table again by reinstalling the app
This problem is mainly caused by syntax. for example, previously my code was correct. here it is:
String CREATE_PRODUCTS_TABLE = "CREATE TABLE " + TABLE_PRODUCTS + "("
+ COLUMN_ID + " INTEGER PRIMARY KEY," + COLUMN_MESSAGEADDRESS
+ " TEXT," + COLUMN_MESSAGEBODY + " TEXT " + ")";
The above code was running correct but i added another column and it started causing the mentioned error. below is the erroneous code:
String CREATE_PRODUCTS_TABLE = "CREATE TABLE " + TABLE_PRODUCTS + "("
+ COLUMN_ID + " INTEGER PRIMARY KEY," + COLUMN_MESSAGEADDRESS
+ " TEXT," + COLUMN_MESSAGEBODY + " TEXT" + COLUMN_MESSAGETIME + " LONG" + ")";
As you can see, when i added the new column i forgot to include a comma after type TEXT. this means that when this code is executed, there will be syntax error as the compiler will read the last part as:
COLUMN_MESSAGEBODY TEXTCOLUMN_MESSAGETIME LONG
as opposed to:
COLUMN_MESSAGEBODY TEXT, COLUMN_MESSAGETIME LONG
Solution: ensure that your syntax is correct and you heed to spaces and commas.
kindly check the below link for more info: Android : Table has no column named "variable name" MySql Database error