SQLite on Android return wrong result -
i'm having troubles querying sqlite db android app.
this table i'm querying:
id | customercode | invoicenumber | openamount | grossamount and datas:
1 | 1 | 1 | -1.00 | -1.00 2 | 1 | 1 | 1.00 | 1.00 3 | 1 | 1 | 10.00 | 10.00 4 | 1 | 2 | 0.00 | 20.00 5 | 1 | 3 | 0.00 | 30.00 i'm trying fetch lines have openamount != "0.00" , query is:
string whereclause = mytable.customer_code + " = ? " + "and " + mytable.open_amount + " != \"0.00\""; cursor cur = mdb.query(mytable.table, null, whereclause, new string[]{customerid}, null, null, null); the result expect query fetch first 3 lines table, , result obtain if query db external application (like sqlite magic).
but... when run query application, obtain line openamount = -1.00.
i've tried lot of solutions, changing condition fetch lines, seems querying app not reads line 2 , 3.
i can't figure out solution. little appreciated.
edit
- all columns
text. - it's not relevant how iterate trhough datas, in fact cursor altready returns wrong number of lines.
edit 2
i'm cycling though result cursor, , how it:
list<myobject> list = new arraylist<>(); myobject obj; //initialization of columnsindex //int idx1 = cur.getcolumnindex(columnname); if (cur.movetofirst()) { { obj = new myobject(); //set obj data list.add(obj); } while (cur.movetonext()); } cur.close();
try this:
string whereclause = mytable.customer_code + " = ? " + "and " + mytable.open_amount + " not '0.00'"; cursor cur = mdb.query(mytable.table, null, whereclause, new string[]{customerid}, null, null, null);
Comments
Post a Comment