如何解决此问题?我检查了所有库,但无法解决。我在行中添加了注释。
public void onCreate(SQLiteDatabase db)
{
String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + "("
+ ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ ifade + " TEXT," + yorum + " TEXT"+")";
db.execSQL(CREATE_TABLE);
}
public void addanswer(String ifadestring,String yorumstring)
{
ContentValues values = new ContentValues();
values.put(ifade, ifadestring);
values.put(yorum, yorumstring);
db.insert(TABLE_NAME, null, values); //ERROR cannot find symbol variable db
db.close(); //ERROR cannot find symbol variable db
}
答案 0 :(得分:0)
确保您的db文件具有.db扩展名或其他名称,然后将其放在android软件包中的assest文件夹中
答案 1 :(得分:0)
解决方案
public void AnkatorEkle(String ifadestring,String yorumstring)
{
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(ifade, ifadestring);
values.put(yorum, yorumstring);
db.insert(TABLE_NAME, null, values);
db.close();
}