Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Before inserting a record in the database to validate that there is, for example I have a table that has two fields, table fields VA with Customer, First, I want to validate the field if there is no customer registration and if there insert That i want to do in android using Sqlite | |||
After this check by following code
| |||
Look at SQLite constraints. This really isn't Android-specific; it's a feature of SQLite. | |||
Try this, it works for me.
| |||
You have 2 possibilities : 1)make a select to check if there is the same key in database, then insert or update. 2)make directly an update. update will return the number of row updated, if the number is 0, so you can do an insert. | ||||
lang-sql
.
stackoverflow.comm
No comments:
Post a Comment