私のコードには、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'