日期:2014-05-20  浏览次数:20575 次

该字符串未被识别为有效的布尔值。谁帮我解决!~~分给谁
异常详细信息:   System.FormatException:   该字符串未被识别为有效的布尔值。

源错误:  


行   57:   comm.Parameters[ "@pageCount "].Direction   =   ParameterDirection.Output;
行   58:   cnn.Open();
行   59:   comm.ExecuteNonQuery();
行   60:   //DataTable   dt;
行   61:   //dt=Comm.tools.ConvertDataReaderToDataTable(dr);
 

源文件:   d:\web\12\protest.aspx.cs         行:   59  

堆栈跟踪:  


[FormatException:   该字符串未被识别为有效的布尔值。]
      System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior   cmdBehavior,   RunBehavior   runBehavior,   Boolean   returnStream)   +742
      System.Data.SqlClient.SqlCommand.ExecuteNonQuery()   +196
      info.protest.CutPageData()   in   d:\web\12\protest.aspx.cs:59
      info.protest.Page_Load(Object   sender,   EventArgs   e)   in   d:\web\12protest.aspx.cs:28
      System.Web.UI.Control.OnLoad(EventArgs   e)   +67
      System.Web.UI.Control.LoadRecursive()   +35
      System.Web.UI.Page.ProcessRequestMain()   +750

 


------解决方案--------------------
_comm.Parameters.Add( "@Sort ", SqlDbType.Bit);
_comm.Parameters[ "@Sort "].Value = "1 ";
==>
_comm.Parameters.Add( "@Sort ", SqlDbType.Bit);
_comm.Parameters[ "@Sort "].Value = true;