I'm getting this error for my SQLite database in Android app. This is the first time I'm having an issue with this error so I need help.
Here's my code:
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_WE_TABLE = "CREATE TABLE " + Constants.TABLE_NAME +
"("+ Constants.KEY_ID + " INTEGER PRIMARY KEY , " +
Constants.JOB_TITLE + " TEXT NOT NULL , " + Constants.JOB_DESCRIPTION +
" TEXT NOT NULL , " + Constants.START_YEAR + " TEXT NOT NULL , " +
Constants.END_YEAR + " TEXT NOT NULL);";
db.execSQL(CREATE_WE_TABLE);
}
And my error:
android.database.sqlite.SQLiteException: near "1": syntax error (code 1): , while compiling: CREATE TABLE workexperience(_id INTEGER PRIMARY KEY , title TEXT NOT NULL , description TEXT NOT NULL , 1 TEXT NOT NULL , 1 TEXT NOT NULL);
What seems to be a problem?
Try to print your create table statement. its clearly says that syntax is not correct. Correct the syntax then it will work fine.
EDIT: as in comment section suggested you cant have column two column name as 1. please change it to work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.