Home » Java » java – unrecognized token: "'SELECT ID FROM ALLWORKHOURS" (code 1 SQLITE_ERROR[1]):-Exceptionshub

java – unrecognized token: "'SELECT ID FROM ALLWORKHOURS" (code 1 SQLITE_ERROR[1]):-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I do not understand what LogCat is trying to tell me. can anyone explain it to me? Thank you :)!

Log Cat

unrecognized token: "'SELECT ID FROM ALLWORKHOURS" (code 1 SQLITE_ERROR[1]): , while compiling: DELETE FROM ALLWORKHOURS WHERE ID = 'SELECT ID FROM ALLWORKHOURS
at com.example.workhours.DataBaseHelper.deleteMyNote(DataBaseHelper.java:101)

Code:

public static final String COL_0 =  "ID";

    98)  public void deleteMyNote(String ID){
    99)      SQLiteDatabase db = this.getWritableDatabase();
    100)     String idDelete =("DELETE FROM " + TABLE_NAME + " WHERE " + COL_0 + " = '" + ID);
    101)     db.rawQuery(idDelete,null);
    102) }
    103) public String getID(){
    104)    SQLiteDatabase db = this.getWritableDatabase();
    105)    String  query = ("SELECT " + COL_0 + " FROM " + TABLE_NAME);
    106)    db.rawQuery(query,null);
    107)    return query;
    108) }
How to&Answers: