以下是我创建表格的查询,
String CREATE_OWNER_TABLE = "CREATE TABLE " + TABLE_OWNER + "(" + KEY_NAME + " TEXT NOT NULL," + KEY_CODE + " TEXT NOT NULL," + KEY_NUMBER + " TEXT NOT NULL," + KEY_SUM + "TEXT NOT NULL );";
db.execSQL(CREATE_OWNER_TABLE);
我写了一个类似的查询来创建表所有者。但是有一个错误告诉我该表没有名为sum
的列答案 0 :(得分:4)
您在上一列的数据类型声明
之前缺少空格KEY_SUM + "TEXT NOT NULL
添加如下空格
String CREATE_OWNER_TABLE = "CREATE TABLE " + TABLE_OWNER + "(" + KEY_NAME + " TEXT NOT NULL," + KEY_CODE + " TEXT NOT NULL," + KEY_NUMBER + " TEXT NOT NULL," + KEY_SUM + " TEXT NOT NULL );";
db.execSQL(CREATE_OWNER_TABLE);
答案 1 :(得分:1)
试试这个
String CREATE_OWNER_TABLE = "CREATE TABLE " + TABLE_OWNER + "(" + KEY_NAME + " TEXT NOT NULL," + KEY_CODE + " TEXT NOT NULL," + KEY_NUMBER + " TEXT NOT NULL," + KEY_SUM + " TEXT NOT NULL);";