Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Colin Millar 7 posts 27 karma points
    Sep 05, 2013 @ 10:33
    Colin Millar
    0

    Import Form fails with foreign key constraint violation

    Hello,

    I've got a large form which I've developed locally and am looking to deploy to the production environment. I export it from Contour but when I try to re-import it I get the following error:

    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UFPrevalues_UFFields". The conflict occurred in database "XYZ", table "dbo.UFFields", column 'Id'.
    The statement has been terminated.

    The relevant bits from the stack trace are as follows:

    umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +362
       Umbraco.Forms.Data.Storage.PreValueStorage.InsertPreValue(PreValue prevalue) +503
       Umbraco.Forms.Core.Providers.Prevalues.Standard.InsertValue(PreValue pv) in c:\Program Files (x86)\teamcity\buildAgent\work\fdc2f0fcbbcef310\Umbraco.Forms.Core.Providers\Prevalues\Standard.cs:71
       Umbraco.Forms.Data.Storage.FieldStorage.UpdateField(Field field) +1785
       Umbraco.Forms.Data.Storage.FieldSetStorage.InsertFieldSet(FieldSet fieldset, Boolean ignoreFieldCondtionRules) +1131

     

    Any ideas of how I may resolve this? The form has taken some time to put together so I'm reluctant to simply recreate it from scratch.

    Many thanks,

    Colin

  • Comment author was deleted

    Sep 11, 2013 @ 15:17

    Hey Colin,

    Which Contour version are you running?

  • Frank Schjelderup 6 posts 26 karma points
    Feb 11, 2014 @ 14:58
    Frank Schjelderup
    0

    I have the same error. I run Umbraco 4.11.3 with Contour 3.014 and the form was created on the same installation, exported for temporary backup, deleted in the UI, and then I tried to import it back in.

    The form seems to be partially imported ok, but is cut off with the first field with conditions on it. 

    Any idea?

    This is my complete errormsg:

    Server Error in '/' Application.


    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UFFieldConditionRules_UFFields". The conflict occurred in database "xxx", table "dbo.UFFields", column 'Id'.
    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: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UFFieldConditionRules_UFFields". The conflict occurred in database "xxx", table "dbo.UFFields", column 'Id'.
    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): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UFFieldConditionRules_UFFields". The conflict occurred in database "xxx", table "dbo.UFFields", column 'Id'.
    The statement has been terminated.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1753986
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5296058
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1682
       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) +1379
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +175
       System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +205
       System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +160
       Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) +56
       Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) +78
       umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteNonQuery(String commandText, SqlParameter[] parameters) +18
       umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +81
    
    [SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery]
       umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +201
       Umbraco.Forms.Data.Storage.FieldConditionRuleStorage.InsertFieldConditionRule(FieldConditionRule fieldConditionRule) +427
       Umbraco.Forms.Data.Storage.FieldConditionStorage.UpdateFieldCondition(FieldCondition fieldCondition) +833
       Umbraco.Forms.Data.Storage.FieldStorage.UpdateField(Field field) +2147
       Umbraco.Forms.Data.Storage.FieldSetStorage.UpdateFieldSet(FieldSet fieldset) +668
       Umbraco.Forms.Data.Storage.PageStorage.UpdatePage(Page page) +668
       Umbraco.Forms.Data.Storage.FormStorage.UpdateForm(Form form) +2046
       Umbraco.Forms.Data.ImportExportHelper.ImportFormFromXml(XmlDocument xd, Boolean insert) +565
       Umbraco.Forms.UI.Dialogs.importForm.import_Click(Object sender, EventArgs e) +162
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9552874
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
       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) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18055              

  • Comment author was deleted

    Feb 11, 2014 @ 15:46

    Upgrade to latest version :) already fixed

Please Sign in or register to post replies

Write your reply to:

Draft