gpt4 book ai didi

android - sqlite返回: error code = 1, msg = near “TABLEtable_restaurants” : syntax error,

转载 作者:行者123 更新时间:2023-12-03 08:23:29 25 4
gpt4 key购买 nike

public class RestaurantHelper extends SQLiteOpenHelper{

public static final String TABLE_RESTAURANTS = "table_restaurants";
public static final String COL_ID = "ID";
public static final String COL_NAME = "NAME";
public static final String COL_ADRESSE = "ADRESSE";
public static final String COL_GENRE = "GENRE";
public static final String COL_NOTES = "NOTES";
public static final String COL_TELEPHONE = "TELEPHONE";

private static final String CREATE_BDD = "CREATE TABLE" + TABLE_RESTAURANTS +
" (" + COL_ID + "INTEGER PRIMARY KEY AUTOINCREMENT," + COL_NAME + "TEXT NOT NULL," +
COL_ADRESSE + "TEXT NOT NULL," + COL_GENRE + "TEXT NOT NULL," + COL_NOTES + "TEXT NOT NULL," +
COL_TELEPHONE + "TEXT NOT NULL);";


public RestaurantHelper(Context context, String name,CursorFactory factory, int version) {
super(context, name, factory, version);
}

@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_BDD);

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE"+ TABLE_RESTAURANTS);
onCreate(db);
}

}

I am new to android i get this error message but i cant figure out whats wrong. thanks.

最佳答案

添加所需的空间。

private static final String CREATE_BDD = "CREATE TABLE " + TABLE_RESTAURANTS +
" (" + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_NAME + " TEXT NOT NULL, " +
COL_ADRESSE + " TEXT NOT NULL, " + COL_GENRE + " TEXT NOT NULL, " + COL_NOTES + " TEXT NOT NULL, " + COL_TELEPHONE + " TEXT NOT NULL);";

关于android - sqlite返回: error code = 1, msg = near “TABLEtable_restaurants” : syntax error,,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17891591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com