在我的代码中,有一个函数可以检索其中 countdesc= inputText 和 countdate= datevalue 的行。但是 countdesc 和 countdate 都被分配为 EditText 。这里给出了 logcat。请帮我找出错误。
public Cursor fetchEventByName(String inputText,String datevalue ) throws SQLException {
SQLiteDatabase db = this.getReadableDatabase();
Cursor mCursor = null;
if (inputText == null || inputText.length () == 0) {
mCursor = db.query(DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_DESC, KEY_DATE, KEY_EVENT },
null, null, null, null, null);
}
else {
mCursor= db.rawQuery("select * from <countable> where countdesc='" + inputText + "' and countdate='" + datevalue+ "'", null);
}
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
日志猫
08-16 06:28:11.730: E/AndroidRuntime(2673): java.lang.RuntimeException: Unable to start activity ComponentInfo{example.events1/example.events1.Getclicker}: android.database.sqlite.SQLiteException: near "<": syntax error (code 1): , while compiling: select * from <countable> where countdesc='Yalahanka' and countdate='Yalahanka'