(0x80131904): String or binary data would be truncated.

时间:2025-03-05 17:49:31
 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,,180227071214iq,New,pd100,2018/2/27 7:13:03,
[2018-02-27 07:13:03,606]  7 -- INFO  -- LogHelper [WriteLog] --  (0x80131904): String or binary data would be truncated.
The statement has been terminated.
   在 (SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   在 (TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   在 (RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   在 (SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
   在 (CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   在 (CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   在 (TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   在 ()
   在 (String sql, SqlParameter[] paras) 位置 c:\QMSoft\FastFlow\FastFlow\App_Code\Tools\:行号 310
ClientConnectionId:2c2accde-ec5d-4f25-84db-a578f09a9609

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

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