String CREATE_TABLE_MSG="CREATE TABLE "+TABLE_NAME_MSG+"("+FROM+" TEXT PRIMARY KEY,"+STATUS+" TEXT,"+MESSAGE+" TEXT,"+PIC+" TEXT,"+TYPE+" TEXT,"+TIME+" TEXT CURRENT_TIMESTAMP,"+SENDID+" TEXT AUTOINCREMENT"+")";
db.execSQL(CREATE_TABLE_MSG);
答案 0 :(得分:1)
FROM
就是其中之一。不区分大小写。
如果您想使用关键字作为名称,则需要引用它
因此,您需要引用列
CREATE TABLE messages (`FROM` TEXT PRIMARY KEY
或者,只需重命名该列,使其不像_from
答案 1 :(得分:0)
如评论From
中所述,keyword in SQLite为{{3}}。如果您确实需要将其用作列名,则必须引用它。
'keyword' A keyword in single quotes is a string literal. "keyword" A keyword in double-quotes is an identifier.