私は私のコードを実行し、 ComponentInfo活動を開始することができません:android.database.sqlite.SQLiteException:近い「/」:構文エラー...アンドロイドSQLiteの例外に近い「/」
それがなぜ機能しません。 ? 事前にありがとうすべて.. ここでは私のヘルパークラスが
public class Helper extends SQLiteOpenHelper{
public static final String MYDATABASE_TABLE = "Restaurant";
public static final String KEY_ID = "_id";
public static final String KEY_CONTENT1 = "Restaurant name";
public static final String KEY_CONTENT2 = "Ac/non ac";
public static final String KEY_CONTENT3 = "Total chairs";
public static final String KEY_CONTENT4 = "Reserved chairs";
public static final String KEY_CONTENT5 = "Date";
public static final String KEY_CONTENT6 = "fromTime";
public static final String KEY_CONTENT7 = "toTime";
public static final String KEY_CONTENT8 = "Name";
public static final String KEY_CONTENT9 = "Contact Number";
public static final String KEY_CONTENT10 = "Table id";
private static final String SCRIPT_CREATE_DATABASE =
"create table " + MYDATABASE_TABLE + " ("
+ KEY_ID + " integer primary key autoincrement, "
+ KEY_CONTENT1 + " text not null, "
+ KEY_CONTENT2 + " text not null, "
+ KEY_CONTENT3 + " integer not null, "
+ KEY_CONTENT4 + " integer not null, "
+ KEY_CONTENT5 + " text not null, "
+ KEY_CONTENT6 + " text not null, "
+ KEY_CONTENT7 + " text not null, "
+ KEY_CONTENT8 + " text not null, "
+ KEY_CONTENT9 + " text not null, "
+ KEY_CONTENT10 + " text not null) ";
public Helper(Context context, String name, CursorFactory factory,
int version) {
super(context, name, factory, version);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
db.execSQL(SCRIPT_CREATE_DATABASE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
これをチェックするKEY_CONTENT2 = "Ac/non ac" ' – idiottiger
私は実際にはわかりませんが、カラム名に"/"のような"スペース "と"特殊文字 "を使用することは許されません... – drulabs
この投稿http://stackoverflow.com/questions/3373234/what-sqlite-column-name-can-be-cannot-be – ccheneson