所以这是我的数据库代码
private SQLiteDatabase db;
private SQLiteStatement insertStatement;
private String DB_Table = "trainingsplan";
private String INSERT = "insert into " + DB_Table
+ "(zweckkuerzel,aktuellertp,zweck)" + "values (?,?,?)";
它表示错误在选择参数中。
private String SEL_ROW = "select zweckkuerzel,aktuellertp,zweck from "
+ DB_Table;
private String CREATE_TABLE = "create table " + DB_Table
+ "(zweckkuerzel String, "
+ "aktuellertp String NOT NULL, "
+ "zweck String)";
private String CREATE_INDEX = "create index if not exists " + DB_Table
+ "_ind " + "ON " + DB_Table + " (zweckkuerzel)";
在这里,我创建了我的Dao和Tabel
TrainingsplanDao trainingsDao= new TrainingsplanDao(db);
trainingsDao.createTable();
trainingsDao.fillTable();
这是我道的建构者
public TrainingsplanDao(SQLiteDatabase db) {
this.db = db;
try {
insertStatement = db.compileStatement(INSERT);
Log.d("ANDRO VEGI", "Create INSERT product");
} catch (SQLException e) {
Log.d("ANDRO VEGI", "NO Database, NO INSERT TrainingsplanDao()");
}
}
答案 0 :(得分:1)
它清楚地表明在db中找不到名为trainingsplan
的表。请确保它实际上以相同的名称存在。