Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    May 31, 2012 @ 11:18
    Rasmus Fjord
    0

    Creating Media through api casts sql error "string of binary data would be truncated..." Help

    Hey

    Im doing a "small" app that uploades images to umbraco v4.7.2 through the api. The reason im doing it is because it needs to read out meta data and add it as properties, and it works brillantly. but after a few gb of data it just hits an sql error.

    String or binary data would be truncated.
    The statement has been terminated.

    This is normally an error thrown when something is not fitting inside the row like if you put in 300 char long varible into a varchar(250) or something like that.

    But here it just stops at a random 10mb image with nothing out of the ordinary.

    I hope you can help. Ive provided an image at what line its failing(its a function from the uhelpsy lib but basicly it just creates a media item with its properties.) Ive also provided the stack trace of the fail.

    Stacktrace:

    [SqlException (0x80131904): String or binary data would be truncated.
    The statement has been terminated.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1742110
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5279619
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1434
       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) +1355
       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) +79
    
    [SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery]
       umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +134
       umbraco.cms.businesslogic.datatype.DefaultData.set_Value(Object value) +732
       umbraco.cms.businesslogic.property.Property.set_Value(Object value) +11
       uHelpsy.Core.UmbracoAPIHelper.UpdateMediaProperties(Media m, Dictionary`2 properties) +169
       uHelpsy.Core.UmbracoAPIHelper.UpdateMedia(Media m, String filePath, Byte[] bytes, Dictionary`2 properties, Int32 parentId) +447
       uHelpsy.Core.UmbracoAPIHelper.CreateMedia(String alias, String filePath, Byte[] bytes, Dictionary`2 properties, Int32 parentId) +133

     

Please Sign in or register to post replies

Write your reply to:

Draft