将数据插入SQL Server数据库时出现以下异常。
System.Data.SqlClient.SqlException:字符串或二进制数据将被截断 声明已经终止 在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection)
在System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)
在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
在System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)
在System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString)
在System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async)
在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method,DbAsyncResult result)
在System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult结果,String methodName,Boolean sendToPipe)
在System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at SubjectDataAccess.InsertUrls(String url,String urltitle,String urldetails,String favicon,String imagedata)在d:\ project \ New Folder \ March 5 \ March 5 \ ProfileTenModified \ App_Code \ SubjectsDataAccessLayer \ SubjectDataAccess.cs:line 723}
数据是
网址:
http://www.mnn.com/earth-matters/space/photos/10-places-on-earth-that-resemble-alien-planets/etosha-pan-namibia
标题:
10 places on Earth that resemble alien planets: Etosha pan, Namibia
10开头是否会导致问题...
答案 0 :(得分:1)
确保数据小于表格上的数据