Java SQL Querying With TextFields -
i wrote sql query , used textfield getting data. when textfield empty, gives data. how can stop that? here code:
string sql = "select * boek naam '%" + txtnaam.gettext() + "%' or auteur '%" + txtauteur.gettext() + "%' or categorie '%" + txtcategorie.gettext() + "%' or opleiding '%" + txtopleiding.gettext() + "%' not opleiding '%" + txtopleiding.gettext() + "%' ";
i guess looking query text field(s) has value , ignore rest empty.
my suggestion be:
1) write java logics determine inputs program first. e.g. author, category selected fields , not empty.
2) run dedicated sql queries facilitate search inputs selected. e.g. in case, select using author , category
so, there few sql queries there. not 1 handles everything. less confusing in opinion. hope helps :)
Comments
Post a Comment