System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.
Hi all,
I am running the content service to update the information stored in a custom data type. The information I am trying to store is a large string containing JSON data. I am receiving the following error message when trying to do so suggesting the type for this field in the Umbraco database is being limited. This should not be happening as we should be able to enter a lot of information especially for a multi-line textbox field.
How do I get around this?
System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteScalar()
at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar()
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClassa.<ExecuteScalarWithRetry>b__9()
at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy cmdRetryPolicy, RetryPolicy conRetryPolicy)
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command, RetryPolicy retryPolicy)
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.ExecuteScalarWithRetry(IDbCommand command)
at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
at Umbraco.Core.Persistence.Database.Insert(Object poco)
at Umbraco.Core.Persistence.Repositories.ContentRepository.PersistUpdatedItem(IContent entity)
at Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity)
at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action`1 transactionCompleting)
at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit()
at Umbraco.Core.Services.ContentService.SaveAndPublishDo(IContent content, Int32 userId, Boolean raiseEvents)
at Umbraco.Core.Services.ContentService.SaveAndPublishWithStatus(IContent content, Int32 userId, Boolean raiseEvents)
at Axum.Update.AxumGroupTourController.GetTourMasters() in c:\Users\Jason\Documents\Iceland Mountain Guides\Iceland Mountain Guides\Controllers\AxumGroupTourController.cs:line 332
ClientConnectionId:50991256-0743-4cce-a514-85b969b53435
Error Number:8152,State:13,Class:16
May be you should set valueType to "TEXT" in your custom data type editor's manifest. This will result in storing the data in dataNtext db field wich is not limited to 500 chars unlike dataNvarchar field.
System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.
Hi all,
I am running the content service to update the information stored in a custom data type. The information I am trying to store is a large string containing JSON data. I am receiving the following error message when trying to do so suggesting the type for this field in the Umbraco database is being limited. This should not be happening as we should be able to enter a lot of information especially for a multi-line textbox field.
How do I get around this?
May be you should set valueType to "TEXT" in your custom data type editor's manifest. This will result in storing the data in dataNtext db field wich is not limited to 500 chars unlike dataNvarchar field.
Instead I changed the NVarchar in the database to NVarchar(Max)
is working on a reply...