UNIQUE constraint failed: sqlite database : android

前端 未结 10 2012
野的像风
野的像风 2020-12-05 09:34

I am trying to insert values in table. But there is only one value inserted. I am getting an error in log cat when I am trying to insert new values.

Log cat shows :

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 09:52

    The table has a unique constraint on it. That means that only one row can exist with a given ID value. If you're trying to change some of the values for a row, use UPDATE not INSERT. If you're trying to add this row, you need to either give it a different, unique ID or you need to delete the pre-existing row first. Which of these is the right answer depends on what your app is doing.

提交回复
热议问题