This line:
db.update(LoginTable.TABLE_NAME, values, LoginTable.Cols.CONSUMER_ID + "=?" + userModel.consumer_no, null);
is incorrect.
You have 2 choices.
The 1st is to concatenate the value passed to LoginTable.Cols.CONSUMER_ID
like this:
db.update(LoginTable.TABLE_NAME, values, LoginTable.Cols.CONSUMER_ID + " = '" + userModel.consumer_no + "'", null);
if userModel.consumer_no
is a string, or:
db.update(LoginTable.TABLE_NAME, values, LoginTable.Cols.CONSUMER_ID + " = " + userModel.consumer_no, null);
if userModel.consumer_no
is an integer value.
The 2nd choice is better and safer:
db.update(LoginTable.TABLE_NAME, values, LoginTable.Cols.CONSUMER_ID + " = ?", new String[] { String.valueOf(userModel.consumer_no) });
You can omit String.valueOf()
if userModel.consumer_no
is a string.
The error in your code is that you mixed somehow the above 2 ways of passing the argument userModel.consumer_no
to the update()
method.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…