我正在尝试使用 SQLite 为 android 应用程序创建一个数据库表,但我遇到了问题。每次我尝试转储数据库时,该应用程序都会崩溃。它给了我一个错误“没有这样的列:_id”。我多次检查以确保_id 有一列,但它仍然崩溃。我是否正确创建了表格?
public static final String NAME = "contacts";
public static final String ID = "_id";
public static final String COL_NAME = "name";
public static final String COL_INFO = "info";
public static final String COL_SCORE = "score";
final private static String CREATE_CMD =
"CREATE TABLE " + NAME + "(_id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ COL_NAME + " TEXT NOT NULL, "
+ COL_INFO + " TEXT NOT NULL, "
+ COL_SCORE + " TEXT NOT NULL)";