Skip to main content

Android SQLite query with 'WHERE' selection arguments not working



I have this code:







if (idListe.size()>0)

{

strIdArray = new String[idListe.size()];

idListe.toArray(strIdArray);

//my query starts here

c = dbHelper.query(true, DataBaseHelper.DB_COURSE,

dbHelper.COURSE_TABLE_AUFGABEN, new String[] {

dbHelper.COURSE_AUFGABEN_COLUMN_ID,

dbHelper.COURSE_AUFGABEN_COLUMN_ADRESSID,

dbHelper.COURSE_AUFGABEN_COLUMN_KURSART }, dbHelper.COURSE_AUFGABEN_COLUMN_ID + " = ?",strIdArray,

dbHelper.COURSE_AUFGABEN_COLUMN_KURSART, null,

dbHelper.COURSE_AUFGABEN_COLUMN_KURSART + " ASC", null);

startManagingCursor(c);

}







And get a this error:







01-15 13:01:27.489: E/AndroidRuntime(703): android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x3fd490







I've tried several combinations and the result always stays the same. If the size of the strIdArray is '1' the query works. What am I doing wrong here?


Comments

  1. If the size of the strIdArray is '1' the query works. What am I doing
    wrong here?


    You're only having one ? while you provide several parameters when the size of strIdArray is bigger than one.

    ReplyDelete
  2. This code fragment does not explain too much, since it uses some (German) 3rd party library and it hides the actual query.

    However you can try this solution if is relevant.

    It would be easier to help if you could provide more details about the actual query.

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.