简体   繁体   English

将数据存储到SQL Server中的SqlException

[英]SqlException on storing data into SQL Server

I get the following exception when inserting data into SQL Server database. 将数据插入SQL Server数据库时,出现以下异常。

System.Data.SqlClient.SqlException: String or binary data would be truncated. System.Data.SqlClient.SqlException:字符串或二进制数据将被截断。
The statement has been terminated. 该语句已终止。
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) 在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 在System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔值breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 在System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) 在System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,字符串resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) 在System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,布尔returnStream,布尔异步)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) 在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String方法,DbAsyncResult结果)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) 在System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult结果,字符串methodName,布尔sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() 在System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at SubjectDataAccess.InsertUrls(String url, String urltitle, String urldetails, String favicon, String imagedata) in d:\\project\\New Folder\\March 5\\March 5\\ProfileTenModified\\App_Code\\SubjectsDataAccessLayer\\SubjectDataAccess.cs:line 723} 在d:\\ project \\ New Folder \\ March 5 \\ March 5 \\ ProfileTenModified \\ App_Code \\ SubjectsDataAccessLayer \\ SubjectDataAccess.cs:line 723}中的SubjectDataAccess.InsertUrls(String url,String urltitle,String urldetails,String favicon,String imagedata)中

The data is 数据是

Url: 网址:

http://www.mnn.com/earth-matters/space/photos/10-places-on-earth-that-resemble-alien-planets/etosha-pan-namibia

Title: 标题:

10 places on Earth that resemble alien planets: Etosha pan, Namibia

does the 10 is in the beginning cause an issue... 十开头是否会引起问题...

确保数据小于表中的数据大小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用SQL Server的应用程序中的SqlException - SqlException in app using SQL Server 向 SQL 服务器添加数据导致 System.Data.SqlClient.SqlException: 'Invalid column name' - Adding data to SQL Server results in System.Data.SqlClient.SqlException: 'Invalid column name' 将OLEDB转换为SQL Server之后的.updateall中的SqlException - SqlException in .updateall after convert OLEDB to SQL Server 启动与SQL Server的连接时出现异常的SqlException - Unusual SqlException when initiating connection to SQL Server SQL 服务器 Microsoft.Data.SqlClient.SqlException (0x80131904):执行超时在 azure 上过期 - SQL server Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired on azure 从SQL Server存储过程存储有用的数据 - Storing useful data from SQL Server stored procedure 使用C#在SQL Server数据库中存储敏感数据 - Storing sensitive data in SQL server db with C# 使用 C# 在变量中循环和存储来自 SQL Server 的数据 - Looping and storing data from SQL Server in variables using C# 从 XML 读取数据并将它们存储到 SQL Server 数据库中 - Reading Data from XML and storing them into SQL Server database 使用 DataTable 和 DataAdapter 在 SQL Server XML / string 列中存储序列化数据 - Storing serialized data in a SQL Server XML / string column with DataTable and DataAdapter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM