字符串或二进制数据将被截断。该语句已终止。 System.Data.SqlClient.SqlException(0x80131904)

问题描述:


字符串或二进制数据将被截断。语句已终止。

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

System.Data.SqlClient.SqlException(0x80131904):字符串或二进制数据将被截断

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


当C#(model)尝试保存其大小在SQL SERVER数据库表中定义得较小的列的数据记录(该值将值传递给此列字符串)时,抛出此异常

This exception throws when C#(model) try to save data record for column whose size defined less in SQL SERVER database table where value to pass to this column string length in greater.

要解决此错误,您只需使用SQL Server脚本更改SQL SERVER数据库中的表列。

To fix this error you only need to alter column of table in SQL SERVER database using SQL Server script.

仅增加表中列的大小。无需在PROD / TEST环境中重新部署应用程序。

Only increasing size of column in table works. No need to re deploy the application on PROD/TEST environment.