日期:2014-05-18  浏览次数:20899 次

求教 将截断字符串或二进制数据。语句以终止.
今天在处理项目的时候出现了上述的话并且 报错信息为
C# code
“/gougouoa”应用程序中的服务器错误。
--------------------------------------------

将截断字符串或二进制数据。
语句已终止。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.Data.SqlClient.SqlException: 将截断字符串或二进制数据。
语句已终止。

源错误: 


行 67:         cmd.CommandText = strSql;
行 68:         cmd.Connection = conn;
行 69:         cmd.ExecuteNonQuery();
行 70:         //conn.Close(); 
行 71:         //conn.Dispose(); 
 

源文件: d:\gougouoa\App_Code\WebService.cs    行: 69 

堆栈跟踪: 


[SqlException (0x80131904): 将截断字符串或二进制数据。
语句已终止。]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +98
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3430
   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +273
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +367
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149
   WebService.ExcuteSql(String strSql) in d:\gougouoa\App_Code\WebService.cs:69
   guanli_guanlitree_qingjia.Button1_Click(Object sender, EventArgs e) in d:\gougouoa\guanli\guanlitree\qingjia.aspx.cs:33
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +96
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +116
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3825

 


--------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433 

我在设置断点后发现输入TEXTBOX的字符串不能转换为SERTING 而是以下面这种形式出现 strsql=null
SQL code
insert into Absenteeisminfo(Name,Datetime,Date,Subject) values('System.Web.UI.WebControls.TextBox','System.Web.UI.WebControls.TextBox','System.Web.UI.WebControls.TextBox','System.Web.UI.WebControls.TextBox');

请问各位老师要怎么写才能把TEXTBOX的书写文本变成STRING 然后输入到库内那?
C# code
public partial class guanli_guanlitree_qingjia : System.Web.UI.Page
{
    //private string strSql = null;
    WebService webs = new WebService();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/guanli/guanlitree/qingjia.aspxd");                                                                                                                                                                                                                                                                                                                                      
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if