Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Server Error in '/project_office' Application.
--------------------------------------------------------------------------------

Violation of UNIQUE KEY constraint 'IX_Policy_Absent_Policy'. Cannot insert duplicate key in object 'dbo.Policy_Absent_Policy'.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'IX_Policy_Absent_Policy'. Cannot insert duplicate key in object 'dbo.Policy_Absent_Policy'.
The statement has been terminated.

Source Error:


Line 309:
Line 310: con.Open();
Line 311: cmd.ExecuteNonQuery();
Line 312: con.Close();
Line 313: Response.Redirect("Policy_Masters.aspx");


Source File: d:\Abhi\latest updates\project_office\Policy_Masters.aspx.cs Line: 311

Stack Trace:


[SqlException (0x80131904): Violation of UNIQUE KEY constraint 'IX_Policy_Absent_Policy'. Cannot insert duplicate key in object 'dbo.Policy_Absent_Policy'.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
Policy_Masters.Button21_Click(Object sender, EventArgs e) in d:\Abhi\latest updates\project_office\Policy_Masters.aspx.cs:311
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Posted
Comments
David_Wimbley 11-Aug-13 16:23pm    
You should post your code where your application crapped out. Also, if that snippet does not include your SQL statement, you should post your sql statement. A stack trace of your exception is a good start but we don't have access to your hard drive and don't work with you on a daily basis so we don't have the slightest idea what it is you are doing. Too much information is better then not enough information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900