none
A duplicate value cannot be inserted into a unique index. (25016) RRS feed

  • Question

  • I have a wince database (.sdf), where i am inserting data from a wince application.

    The table is having composite primary key (3 columns serving as primary key).

    2 of the colums remain unchanged mostly and the third column which changes always is of type DateTime (data is fed to this column using DateTime.Now with DATE_FORMAT = "yyyy-M-d HH:mm:ss")).

    Now I am getting the following error sometimes.

    A duplicate value cannot be inserted into a unique index. (25016)

    Please help.

    Friday, June 22, 2012 12:09 PM

All replies

  • have you checked if the values do really violate a unique index constraint?

    Monday, June 25, 2012 1:49 AM
    Moderator
  • We are not creating any indexes on the DB, but the DB creates an index (for the primary key combination). How can we check if the unique index is violated?

    Monday, June 25, 2012 2:53 AM
  • is this related to sync framework? or just plain SQL Ce app?

    Monday, June 25, 2012 3:36 AM
    Moderator
  • Its a plain SQL ce app.
    Monday, June 25, 2012 8:53 AM
  • this is the sync framework forum, you might want to cross post this on the sql ce forums: http://social.msdn.microsoft.com/forums/en-US/sqlce/threads/

    i suggest you check the indeces of the table encountering the error and make sure that your app is not inserting a duplicate value.

    Tuesday, June 26, 2012 1:29 AM
    Moderator
  • Thanks, that we have verified, the application never enters duplicate values for the composite (primary) key.
    Tuesday, June 26, 2012 5:27 AM