Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing parameter of _id and updating SQLitedatabase
    primarykey
    data
    text
    <p>I'm trying to update an SQLite table using the row id as my where statement. I'm getting the row _id from a row shown in a listview and passing to another activity with this statement:</p> <pre><code>Cursor cursor = (Cursor) nurseTableAdapter.getItem((int)id); showAssignments.putExtra("Nurse", cursor.getInt(cursor.getColumnIndex("_id"))); </code></pre> <p>The receiving activity receives the parameter:</p> <pre><code>nurse = extras.getString("Nurse"); </code></pre> <p>and passes it as a parameter to my DbCommunicator class:</p> <pre><code>updateAssignments.updateNurseAssignments(listItemsArray, nurse); </code></pre> <p>and my DbCommunicator class does this with it:</p> <pre><code>public void updateNurseAssignments(String[] choices, String nurseId) { // set parameter variables //int nurseIdToInt = Integer.parseInt(nurseId); //String strFilter = "_id=" + nurseIdToInt; //String where = "_id=?"; String[] whereArgs = {String.valueOf(nurseId)}; Log.i(TAG, "value of whereArgs is " + whereArgs[0]); // set content values ContentValues cvUpdate = new ContentValues(); cvUpdate.put(KEY_FIRST_ASSIGNMENT, choices[0]); cvUpdate.put(KEY_SECOND_ASSIGNMENT, choices[1]); cvUpdate.put(KEY_THIRD_ASSIGNMENT, choices[2]); cvUpdate.put(KEY_FOURTH_ASSIGNMENT, choices[3]); cvUpdate.put(KEY_FIFTH_ASSIGNMENT, choices[4]); cvUpdate.put(KEY_SIXTH_ASSIGNMENT, choices[5]); // update database sqldb.update(NURSE_TABLE, cvUpdate, KEY_NURSE_ROWID + "= ?", whereArgs); } </code></pre> <p>I'm getting no errors, but the table is not updating. I've only found one similar example in Stack Overflow, and have tried to incorporate some of that here, but still having problems. Suggestions appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload