在SQlite中如何判断是否存在行更新它还是createEntry? 基本上我想要一个单行表,并在按下单个按钮时更新它。
entry.open();
if(the row already exist)
entry.updateContact(1, Double.toString(db1), Double.toString(db2), Double.toString(db3));
else
entry.createEntry(Double.toString(db1), Double.toString(db2), Double.toString(db3));
entry.close();
答案 0 :(得分:0)
听起来像是INSERT OR REPLACE
。在http://www.buzzingandroid.com/2013/01/sqlite-insert-or-replace-through-contentprovider/