我编写了一个查询,将值插入Android中的数据库:
db.execSQL("CREATE TABLE " + TABLE_NAME + "( " + KEY_SITUATION_NAME
+ " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL,"
+ KEY_LATTIUDE +" NOT NULL," + KEY_LONGITUDE + " NOT NULL," + " );");
但是,当我执行它时,会抛出错误。任何人都能指出它中的错误吗?
答案 0 :(得分:1)
db.execSQL("CREATE TABLE " + TABLE_NAME + "( " + KEY_SITUATION_NAME
+ " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL,"
+ KEY_LATTIUDE +" INTEGER NOT NULL," + KEY_LONGITUDE + " INTEGER NOT NULL" + " );");
为KEY_LATITUDE和KEY_LONGITUDE提供数据类型。
而且你最后还保留了(,)不需要的东西......
答案 1 :(得分:0)
db.execSQL("CREATE TABLE " + TABLE_NAME + "( " + KEY_SITUATION_NAME
+ " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL,"
+ KEY_LATTIUDE +" NOT NULL," + KEY_LONGITUDE + " NOT NULL);");
答案 2 :(得分:0)
正确的代码是:
db.execSQL("CREATE TABLE " + TABLE_NAME + "( " + KEY_SITUATION_NAME
+ " TEXT NOT NULL, " + KEY_CATEGORY_NAME + " TEXT NOT NULL," + KEY_LATTIUDE +" NOT NULL," + KEY_LONGITUDE + " NOT NULL," + " )");