Probably a really simple question, but I have a table in which a column is not set by default. The user can set the contents of that field, which works fine, but they should also be able to clear the field. How do I reset the db field? Its affinity is real
. Do I set an empty string in the field? Null? Thanks.
您可以使用ContentValues.putNull(java.lang.String)
ContentValues args = new ContentValues();
args.putNull(KEY_RISK_AMOUNT);
Simply:
UPDATE myTable SET myField = NULL
It (quite obviously) requires that myField
is NULLABLE.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.