SQLlite: Select query with where clause is not working
<p>This function always return false and cursor is always empty , even there are more the 10 records in the database i have tried querying each record against assignment id but not working.</p>

<p>I have copied the database from virtual device into my pc and used sqlite manger to do the same query and its working in pc and there are all records in the database.</p>

<p>This is my code:</p>

<pre><code>public boolean checkAssignment(String assignmentId) {
        boolean assignmentStored = false;
        String selectQuery = "SELECT * FROM " + TABLE_ASSIGNMENTS +
                " WHERE " + KEY_ASSIGNMENT_ID + " = '" + assignmentId.trim()+"'";
        SQLiteDatabase db = getReadableDatabase();
        Cursor cursor = db.rawQuery(selectQuery, null);

        if (cursor.getCount() &gt; 0) {
            assignmentStored = true;
        }
        cursor.close();
        return assignmentStored;
}
</code></pre>