System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated.

 insert into Ftp_File (trx_id,file_path,file_name,form_id,status,create_by,create_time) values(@trx_id,@file_path,@file_name,@form_id,@status,@create_by,@create_time)T18022707130325_pd100,ftp://127.0.0.1/FastFlow/Flow/180227071214iq,t992.jpg,180227071214iq,New,pd100,2018/2/27 7:13:03,
[2018-02-27 07:13:03,606]  7 -- INFO  -- LogHelper [WriteLog] -- System.Data.SqlClient.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)
   在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   在 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)
   在 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)
   在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   在 MsSql.ExecInsertParaTrans(String sql, SqlParameter[] paras) 位置 c:\QMSoft\FastFlow\FastFlow\App_Code\Tools\MsSql.cs:行号 310
ClientConnectionId:2c2accde-ec5d-4f25-84db-a578f09a9609

  这个问题出现原因是因为数据库中的trx_id的长度小,但是插入数据比较

找到trx_id字段,修改表结构,使表字段大小相同或大于要插入的数据

你可能感兴趣的:(Mariadb)