【发布时间】:2017-05-02 18:39:17
【问题描述】:
您好,我是 android 新手,请帮助我,我无法解决此错误
这是 logcat 错误
android.database.sqlite.SQLiteException: no such column: datename (code 1):
, while compiling: select productinserted from mbudgettable where datename=?
这是在 LOGCAT 中显示错误的行-
www.monthlybudget.suyash.DatabaseHandler.tproduct(DatabaseHandler.java:152)
数据库活动中的行-
151 String query = "select "+productinserted+" from " + tablename + " where datename="; 第 152 行光标 cursor = db.rawQuery(query, new String[] {sto});
这就是我创建数据库的方式-
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_TABLE = "CREATE TABLE " + tablename + "("+KEY_ID + "INTEGER PRIMARY KEY,
" + budgetinserted +" double, " +productinserted + " TEXT, " +amountinserted + " double,
" +todayproductinserted + " TEXT," + todayamountinserted + " double, " + monthlyproductinserted + " string,
" +monthlyamountinserted + " double, " + yearlybudgetinserted + "double, " + datename + "LONG, " + monthyear + "LONG);";
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + tablename);
onCreate(db);
}
请帮帮我,伙计们-
【问题讨论】:
标签: android database sqlite android-sqlite android-database