异常详细信息: 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 

解决方案 »

  1.   

    这里的字符串如果为: "true"或"false" 也许不会报异常!
      

  2.   

    1\确认你的.aspx的文件名不是comm.aspx
    2\将comm改成_comm试试
      

  3.   

    全部代码:
    SqlConnection cnn=new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
    SqlCommand _comm = new SqlCommand("proc_ListPageInt",cnn);
    _comm.CommandType = CommandType.StoredProcedure;
    SqlDataReader dr=null;
    _comm.Parameters.Add("@tblName", SqlDbType.NVarChar, 200);
    _comm.Parameters["@tblName"].Value = " info_public ";
    _comm.Parameters.Add("@fldName", SqlDbType.NVarChar, 500);
    _comm.Parameters["@fldName"].Value = " ";
    _comm.Parameters.Add("@pageSize", SqlDbType.Int);
    _comm.Parameters["@pageSize"].Value = 5;
    _comm.Parameters.Add("@page", SqlDbType.Int);
    _comm.Parameters["@page"].Value = 1;
    _comm.Parameters.Add("@fldSort", SqlDbType.NVarChar, 200);
    _comm.Parameters["@fldSort"].Value = " infoid  ";
    _comm.Parameters.Add("@Sort", SqlDbType.Bit);
    _comm.Parameters["@Sort"].Value = "1";
    _comm.Parameters.Add("@strCondition", SqlDbType.NVarChar, 1000);
    _comm.Parameters["@strCondition"].Value ="  ";
    _comm.Parameters.Add("@ID", SqlDbType.NVarChar, 150);
    _comm.Parameters["@ID"].Value = " infoid ";
    _comm.Parameters.Add("@Counts", SqlDbType.Int, 0);
    _comm.Parameters["@Counts"].Direction = ParameterDirection.Output;
    _comm.Parameters.Add("@pageCount", SqlDbType.Int, 0);
    _comm.Parameters["@pageCount"].Direction = ParameterDirection.Output;
    cnn.Open();
    _comm.ExecuteNonQuery();
      

  4.   

    proc_ListPageInt的存储过程:http://www.cnblogs.com/hertcloud/archive/2005/12/21/301327.html
      

  5.   

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