我不确定为什么会收到此错误。
@Override
public void onCreate(SQLiteDatabase db){
String SQL_CREATE_GOAL_TABLE = "CREATE TABLE"+ GoalContract.GoalEntry.TABLE_NAME + " ("
+ GoalContract.GoalEntry._ID + "INTEGER PRIMARY KEY,"
+ GoalContract.GoalEntry.COLUMN_GOAL_NAME + "TEXT);";
db.execSQL(SQL_CREATE_GOAL_TABLE);
}
答案 0 :(得分:2)
你错过了很多空格:
String SQL_CREATE_GOAL_TABLE = "CREATE TABLE "+ GoalContract.GoalEntry.TABLE_NAME + " ("
+ GoalContract.GoalEntry._ID + " INTEGER PRIMARY KEY,"
+ GoalContract.GoalEntry.COLUMN_GOAL_NAME + " TEXT);";
请注意'table '
之后' Integer'
和' TEXT'
之后的其他空格。
如果生成的SQL中存在语法错误,则调试和查看生成的String
非常有用。