android.database.sqlite.SQLiteException: near "TABLEsusParticipants": syntax error (code 1): , while compiling: CREATE TABLEsusParticipants(_idINTEGER PRIMARY KEY AUTOINCREMENT, f_nameVARCHAR(255), m_nameVARCHAR(255));
我的SQLite语句给出了错误。我无法弄明白。任何帮助..
private static final String DTABASE_NAME = "sport_unleash";
private static final String TABLE_NAME = "susParticipants";
private static final int DATABASE_VERSION = 3;
private static final String ID = "_id";
private static final String F_NAME = "f_name";
private static final String M_NAME = "m_name";
private static final String CREATE_TALBE = "CREATE TABLE" + TABLE_NAME +"("+ID +"INTEGER PRIMARY KEY AUTOINCREMENT, " + F_NAME + "VARCHAR(255), " + M_NAME+ "VARCHAR(255));";
答案 0 :(得分:0)
在"CREATE TABLE"
字符串末尾和"("
字符串的开头需要一个空格,因为表名没有空格,并且会直接附加。< / p>
你的字符串应如下所示:
private static final String CREATE_TALBE = "CREATE TABLE " + TABLE_NAME +" ("+ID +" INTEGER PRIMARY KEY AUTOINCREMENT, " + F_NAME + " VARCHAR(255), " + M_NAME+ " VARCHAR(255));";