0

In SQlite how can I say if a row exists update it else createEntry? basically I want to have a table with single row and update it whenever single button pressed or so.

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();
Vivere_FlowCoder
  • 277
  • 1
  • 4
  • 14

1 Answers1

0

Sounds like you want to INSERT OR REPLACE. There's a blog post on this topic at http://www.buzzingandroid.com/2013/01/sqlite-insert-or-replace-through-contentprovider/

miorel
  • 1,863
  • 2
  • 14
  • 18