Reputation: 1
I'm new in programming, so I get some issues while implemating the sqlite database:
String[] spalten=new String[]{"uebung","datum","ergebnis"};
Cursor cursor1=db.rawQuery("SELECT MAX(uebung) FROM freunde", spalten);
cursor1.moveToFirst();
String r=cursor1.getString(0);
Does Anyone know what the problem is? I just want to read out the content of the box with the highest level.
Upvotes: 0
Views: 181
Reputation: 180300
You are using rawQuery
wrong.
A list of columns to be returned would be used by the query
method.
rawQuery
has the column list in the query string itself; rawQuery
's second parameter is used for query parameters, which you are not using, so binding them fails.
Just use this:
cursor = db.rawQuery("SELECT MAX(uebung) FROM freunde", null);
Upvotes: 1