0

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.

2
  • Where is your placeholder ? ? Commented Jul 31, 2013 at 21:15
  • Explain what you want to do and what kind of issues you get. As the above comment mentions, perhaps you have simply forgotten to add your placeholder? Commented Jul 31, 2013 at 21:30

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.