Hi Joe. Got a primary key error last night and I cannot use the engine anymore.
Violation of PRIMARY KEY constraint ‘PK_LocationDataOptions’. Cannot insert duplicate key in object ‘dbo.LocationDataOptions’.
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 PRIMARY KEY constraint ‘PK_LocationDataOptions’. Cannot insert duplicate key in object ‘dbo.LocationDataOptions’.
The statement has been terminated.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException (0x80131904): Violation of PRIMARY KEY constraint ‘PK_LocationDataOptions’. Cannot insert duplicate key in object ‘dbo.LocationDataOptions’.
The statement has been terminated.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +1767866 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) +5352418
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +269
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource
1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +205
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +160
Microsoft.Practices.EnterpriseLibrary.Data.Database.DoExecuteNonQuery(DbCommand command) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database.cs:443
Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command) in e:\Builds\EntLib\Latest\Source\Blocks\Data\Src\Data\Database.cs:714
SmartThingsRuleBuilder.App_Code.Location.saveLocationDataOptionValue(Int32 AccountId, String DataOptionId, String Name, DataOptionTypes Type) in c:\Users\Joe\Desktop\Projects\SmartThingsRuleBuilder\SmartThingsRuleBuilder\App_Code\Location.cs:259
SmartThingsRuleBuilder.App_Code.Location.updateLocalLocationData() in c:\Users\Joe\Desktop\Projects\SmartThingsRuleBuilder\SmartThingsRuleBuilder\App_Code\Location.cs:177
SmartThingsRuleBuilder.RuleBuilder.Page_Load(Object sender, EventArgs e) in c:\Users\Joe\Desktop\Projects\SmartThingsRuleBuilder\SmartThingsRuleBuilder\RuleBuilder.aspx.cs:52
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
SmartThingsRuleBuilder.App_Code.BasePage.OnLoad(EventArgs e) in c:\Users\Joe\Desktop\Projects\SmartThingsRuleBuilder\SmartThingsRuleBuilder\App_Code\BasePage.cs:14
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772