Try our conversational search powered by Generative AI!

Episerver Forms error when trying to add new form elements to form

Vote:
 

I have just installed the Episerver.Forms nuget package to my solution. When I'm creating a form, I can use some of the simple form elements like text and text area, but when I try to use i.e numbers, fileupload, image etc, I get the following error. Any tips?




The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblContent_tblContentType". The conflict occurred in database " XXXXXXXX", table "dbo.tblContentType", column 'pkID'.


Server Error in '/' Application.

The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblContent_tblContentType". The conflict occurred in database " XXXXXXXX", table "dbo.tblContentType", column 'pkID'.

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_tblContent_tblContentType". The conflict occurred in database " XXXXXXXX", table "dbo.tblContentType", column 'pkID'.

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_tblContent_tblContentType". The conflict occurred in database " XXXXXXXX", table "dbo.tblContentType", column 'pkID'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +3277272
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +345
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +5002
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) +492
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3152
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +704
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +512
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +406
EPiServer.DataAccess.Internal.ContentSaveDB.CreateNewContent(IContent content, String currentUser) +1396
EPiServer.DataAccess.Internal.<>c__DisplayClass23_0.<SaveInternal>b__0() +46
EPiServer.Data.Providers.Internal.<>c__DisplayClass32_0.<ExecuteTransaction>b__0() +15
EPiServer.Data.Providers.Internal.<>c__DisplayClass33_0`1.<ExecuteTransaction>b__0() +58
EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +816
EPiServer.DataAccess.Internal.ContentSaveDB.SaveInternal(IContent content, SaveOptions options) +243
EPiServer.DataAccess.Internal.ContentSaveDB.Save(IContent content, SaveAction action, String currentUser) +297
EPiServer.Core.Internal.DefaultContentProviderDatabase.Save(IContent content, SaveAction action, String currentUser) +50
EPiServer.Core.Internal.DefaultContentProvider.Save(IContent content, SaveAction action) +79
EPiServer.Core.Internal.DefaultContentRepository.Save(IContent content, SaveAction action, AccessLevel access) +757
EPiServer.Forms.EditView.Controllers.FormsElementStore.GetElementByType(Int32 typeId, String parentLink) +533
lambda_method(Closure , ControllerBase , Object[] ) +195
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +229
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +71
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +38
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +60
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157





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



#182220
Sep 12, 2017 15:56
Vote:
 

we had these cases when more than single developer sharing the same db and somebody on the team just fool around content types (like creating new ones or deleting old ones)

#182228
Sep 12, 2017 18:35
Vote:
 

I think you are right. It all magically resolved itself when trying in the evening when no one else was using the db. Thanks!

#182230
Sep 12, 2017 20:40
Vote:
 

auto magic

#182231
Sep 12, 2017 20:57
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.