我创建了一个方法
public boolean addWord(Word w, String name) {
try {
ContentValues cv = new ContentValues();
cv.put(COLUMN_NAME, name);
cv.put(COLUMN_WORD_FOREIGN, w.getWordForeign());
cv.put(COLUMN_WORD_ENGLISH, w.getWordEnglish());
cv.put(COLUMN_CORRECT, w.getCorrect());
database.insert(TABLE_VOCAB_WORDS, null, cv);
return true;
} catch (SQLiteException e) {
System.out.println("SQL ERROR");
return false;
}
}
但是每当我调用它时,我都会收到一个找不到表的错误。但是,我用来创建数据库的 SQL 语句如下:
private static final String CREATE_DB = "CREATE TABLE " + TABLE_VOCAB_INFO
+ "(" + COLUMN_NAME + " TEXT NOT NULL PRIMARY KEY," + COLUMN_URL
+ " TEXT NOT NULL," + COLUMN_DOWNLOADED
+ " TEXT NOT NULL); CREATE TABLE " + TABLE_VOCAB_WORDS + "("
+ COLUMN_NAME + " TEXT NOT NULL," + COLUMN_WORD_FOREIGN
+ " TEXT NOT NULL," + COLUMN_WORD_ENGLISH + " TEXT NOT NULL,"
+ COLUMN_CORRECT + " BYTE NOT NULL, PRIMARY KEY (" + COLUMN_NAME
+ "," + COLUMN_WORD_FOREIGN + "));";
当我清楚地创建表格时,我不太确定这里实际发生了什么错误?
有什么建议么?