Note that there are some explanatory texts on larger screens.

plurals
  1. POSQLite only one column get updated Android
    primarykey
    data
    text
    <p>I have a Sqlite database that works fine, I can insert rows with no problem, but when I try to do an update only one column get updated. I get a return value of 1, but only the column SCANNED get updated, that is the only column that already had a value of 0 and was change to 1.</p> <pre><code>public int UpdateScanInvoice(String Invoice, int scanned, String empname, int empnum) { Calendar c = Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd",Locale.US); String formattedDate = df.format(c.getTime()); SimpleDateFormat tf = new SimpleDateFormat("hh:mm:ss",Locale.US); String formattedTime = tf.format(c.getTime()); String strFilter = MySQLiteHelper.TICKETNR + "='" + Invoice +"'"; ContentValues scanvalues = new ContentValues(); scanvalues.put(MySQLiteHelper.LOADEMPNAME, empname); scanvalues.put(MySQLiteHelper.SCANNED, scanned); scanvalues.put(MySQLiteHelper.LOADEMPNUM, empnum); scanvalues.put(MySQLiteHelper.LOADDATE,formattedDate); scanvalues.put(MySQLiteHelper.LOADTIME, formattedTime); SQLiteDatabase db = dbHelper.getWritableDatabase(); int rowUpdated = db.update(MySQLiteHelper.TABLE_INVOICE, scanvalues,strFilter, null); return rowUpdated; } </code></pre> <p>Maybe my original insert is wrong? This is the original insert.</p> <pre><code>values.put(MySQLiteHelper.SCANNED, 0); values.put(MySQLiteHelper.LOADDATE, ""); values.put(MySQLiteHelper.LOADTIME, ""); values.put(MySQLiteHelper.LOADEMPNAME, ""); values.put(MySQLiteHelper.LOADEMPNUM, ""); </code></pre> <p>I the file has 19 columns and only the last 4 will not update or take any value when I do an insert. I deleted the data recreated the database, same result.</p> <p>Thanks, KimHJ</p>
    singulars
    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