views:

1059

answers:

1

Hi guys.

I have a query that selects rows in a ListView without having a limit. But now that i have implemented a SharedPreferences that the user can select how much rows will be displayed in the ListView, my SQLite query doesnt work. Im passing the argument this way:

return wDb.query(TABELANOME, new String[] {IDTIT, TAREFATIT, SUMARIOTIT}, CONCLUIDOTIT + "=1", null, null, null, null, "LIMIT='" + limite + "'");

Help, please!

+5  A: 

The equals (=) operator is not used with the LIMIT clause. Remove it.

Here's an example LIMIT query:

SELECT column FROM table ORDER BY somethingelse LIMIT 5, 10

Or:

SELECT column FROM table ORDER BY somethingelse LIMIT 10

Take a look here at the SQLite select syntax: http://www.sqlite.org/syntaxdiagrams.html#select-stmt

This image is rather useful: http://www.sqlite.org/images/syntax/select-stmt.gif

Mike Cialowicz
Mike Cialowicz, thank you. I appreciate your quick answer!
Philipz
You're welcome. Please vote up or mark as accepted. Thanks!
Mike Cialowicz
The main problem was that i was inserting the statement LIMIT, where in fact, i should just TYPE THE VALUE! :( haha
Philipz
I cant vote because my reputation is lower than 15, where do i mark as accepted? EDIT: Oh, found it!
Philipz