Results 1 to 2 of 2

Thread: violation unique key constraint [solved]

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    violation unique key constraint [solved]

    yes - this is a wierd one which i havent encountered before. when the tableadapter's update command is called I get this error.

    Code:
    "System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'IX_ReportColumn'. Cannot insert duplicate key in object 'ReportColumn'.
    The statement has been terminated.
       at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
       at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
       at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
       at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
       at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
       at ReportDataSetTableAdapters.ReportColumnTableAdapter.Update(ReportColumnDataTable dataTable) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website\c7de1566\f50d71c3\App_Code.qbpf4itd.1.cs:line 4112
       at _Default.btnSave_Click(Object sender, EventArgs e) in C:\Projects\BE WebReporting\Website\Default.aspx.vb:line 525"

    the table itself has a PK and an FK and has a unique constraint of 2 fields. but its calling the update command so I dont quite understand why its performing an insert statement? perhaps its not.... but why would there be duplicate keys being inserted?
    Last edited by Techno; May 23rd, 2007 at 08:08 AM.

    MVP 2007-2010 any chance of a regain?
    Professional Software Developer and Infrastructure Engineer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width