我创建了一个数据库并在其上创建了一些表。但在某些时候我做错了,所以应用程序在启动时崩溃。这是我的代码的一部分:
private SQLiteStatement insertUserInfos;
private static final String TN_INFO = "UserInfos";
private static final String CREATE_TABLE_INFO = "CREATE TABLE "
+ TN_INFO
+ " ( \"name\" TEXT, \"surname\" TEXT, \"mail\" TEXT, \"password\" TEXT, \"birthyear\" TEXT, \"currentcity\" TEXT, \"futurecity\" TEXT, \"check\" TEXT ) ";
private static final String INSERT_INFOS = "INSERT INTO "
+ TN_INFO
+ " ( name, surname, mail, password, birthyear, currentcity, futurecity, check ) Values (?,?,?,?,?,?,?,?) ";
public DBHelper(Context context) {
this.ctx = context;
DBOpenHelper db = new DBOpenHelper(ctx);
database = db.getWritableDatabase();
insertUserInfos = database.compileStatement(INSERT_INFOS);
}
private class DBOpenHelper extends SQLiteOpenHelper {
public DBOpenHelper(Context context) {
super(ctx, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_INFO);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
我收到了这个错误:
06-27 22:42:01.870: E/AndroidRuntime(16550): 引起: android.database.sqlite.SQLiteException: 在“检查”附近: 语法错误: , 编译时: INSERT INTO UserInfos (name, surname, mail, password ,birthyear,currentcity,futurecity,check ) 值 (?,?,?,?,?,?,?,?)
我检查了很多次,但我在这条线上看不到任何错误。任何帮助都会很好。