String or binary data would be truncated with custom property editor
Hello,
I'm developing a property editor which needs to save JSON. For now I just have some hard coded JSON and I'm trying to save that to see if it works, but that already gives me the following exception:
String or binary data would be truncated.
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: String or binary data would be truncated.
The statement has been terminated.
Stack Trace:
at System.Data.SqlClient.SqlConnection.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() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 299
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.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco)
at Umbraco.Core.Persistence.Database.Insert(Object poco)
I've already seen more topics about this, but valueType is already set correct and I tried rebuilding the site, restarting the app pool, clearing your browser cache, and restarting the website. Nothing seems to work. Any ideas? I'm on Umbraco 7.1.8.
String or binary data would be truncated with custom property editor
Hello,
I'm developing a property editor which needs to save JSON. For now I just have some hard coded JSON and I'm trying to save that to see if it works, but that already gives me the following exception:
When I look into the database the value is still being stored in the dataNvarchar column. No matter what I try it won't save in the dataNtext column.
Jeroen
I found the solution in this topic: http://our.umbraco.org/forum/umbraco-7/developing-umbraco-7-packages/46784-Changes-to-valueType-not-reflected-in-db#comment167619
After chaning the valueType you also need to recreate the datatype.
I've created an issue for this: http://issues.umbraco.org/issue/U4-6050
Jeroen
is working on a reply...