jeudi 10 mars 2016

Android SQL Query not working

I have a query on my app

sqlStr = "SELECT * FROM " + getName() + " WHERE " + FIRST_NAME + " LIKE '%" + fname + "%' OR " + LAST_NAME + " LIKE '%" + lname + "%' OR "
                + AREA_PRAC + " LIKE '%" + location + "%' AND " + REGION + " = '" + region + "'";

Sample Query:

SELECT * FROM view_member_list WHERE l_name LIKE "%Mend%" AND region  = "Region V"

In SqliteManager it shows the data with "%Mend%" on f_name or l_name or location AND with "Region V". But when i used it on my app. The result is different. It seems that it bypass the second condition:

"AND region = 'Region V' "

Aucun commentaire:

Enregistrer un commentaire