我遇到了异常,找不到办法解决:页面提示:
    “/UI”应用程序中的服务器错误。
--------------------------------------------------------------------------------发生类型为 System.StackOverflowException 的异常。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.StackOverflowException: 发生类型为 System.StackOverflowException 的异常。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
[StackOverflowException: 发生类型为 System.StackOverflowException 的异常。] 
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:1.1.4322.573; ASP.NET 版本:1.1.4322.573 
现在确定问题出现在下面的函数public void Add(HouseInfo house)
{
StringBuilder strSQL = new StringBuilder();
strSQL.Append("insert into house(");
strSQL.Append("InforTypeId,");
strSQL.Append("Address,");
strSQL.Append("WuYeTypeId,");
strSQL.Append("expiredate,");
strSQL.Append("hitcount,");
strSQL.Append("owner,");
strSQL.Append("posttime,");
strSQL.Append("rent,");
strSQL.Append("chargetypeid,");
strSQL.Append("area,");
strSQL.Append("circle,");
strSQL.Append("locality,");
strSQL.Append("square,");
strSQL.Append("decorationtype,");
strSQL.Append("shi,");
strSQL.Append("ting,");
strSQL.Append("wei,");
strSQL.Append("bus,");
strSQL.Append("floor,");
strSQL.Append("buildingtall,");
strSQL.Append("housepic,");
strSQL.Append("hxpic,");
strSQL.Append("description,");
strSQL.Append("connect_user,");
strSQL.Append("tel,");
strSQL.Append("mobile,");
strSQL.Append("E_mail,");
strSQL.Append("connect_address,");
strSQL.Append("zip_code,");
strSQL.Append("water,");
strSQL.Append("elec,");
strSQL.Append("gas,");
strSQL.Append("net) ");
strSQL.Append(" values("); strSQL.Append("@infortypeid,");
strSQL.Append("@address,");
strSQL.Append("@wuyetypeid,");
strSQL.Append("@expiredate,");
strSQL.Append("@hitcount,");
strSQL.Append("@owner,");
strSQL.Append("@posttime,");
strSQL.Append("@rent,");
strSQL.Append("@chargetypeid,");
strSQL.Append("@area,");
strSQL.Append("@circle,");
strSQL.Append("@locality,");
strSQL.Append("@square,");
strSQL.Append("@decorationtype,");
strSQL.Append("@shi,");
strSQL.Append("@ting,");
strSQL.Append("@wei,");
strSQL.Append("@bus,");
strSQL.Append("@floor,");
strSQL.Append("@buildingtall,");
strSQL.Append("@housepic,");
strSQL.Append("@hxpic,");
strSQL.Append("@description,");
strSQL.Append("@connect_user,");
strSQL.Append("@tel,");
strSQL.Append("@mobile,");
strSQL.Append("@email,");
strSQL.Append("@connectaddress,");
strSQL.Append("@zipcode,");
strSQL.Append("@water,");
strSQL.Append("@elec,");
strSQL.Append("@gas,");
strSQL.Append("@net)"); SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@infotypeid", SqlDbType.Int),
new SqlParameter("@address", SqlDbType.VarChar, 240),
new SqlParameter("@wuyetypeid", SqlDbType.Int),
new SqlParameter("@expiredate", SqlDbType.DateTime),
new SqlParameter("@hitcount", SqlDbType.Int),
new SqlParameter("@owner", SqlDbType.VarChar, 50),
new SqlParameter("@posttime", SqlDbType.VarChar, 50),
new SqlParameter("@rent", SqlDbType.Int),
new SqlParameter("@chargetypeid", SqlDbType.Int),
new SqlParameter("@area", SqlDbType.Int),
new SqlParameter("@circle", SqlDbType.Int),
new SqlParameter("@locality", SqlDbType.Int),
new SqlParameter("@square", SqlDbType.Float),
new SqlParameter("@decorationtype", SqlDbType.Int),
new SqlParameter("@shi", SqlDbType.Int),
new SqlParameter("@ting", SqlDbType.Int),
new SqlParameter("@wei", SqlDbType.Int),
new SqlParameter("@bus", SqlDbType.VarChar, 60),
new SqlParameter("@floor", SqlDbType.Int),
new SqlParameter("@buildingtall", SqlDbType.Int),
new SqlParameter("@housepic", SqlDbType.VarChar, 120),
new SqlParameter("@hxpic", SqlDbType.VarChar, 120),
new SqlParameter("@description", SqlDbType.VarChar, 240),
new SqlParameter("@connect_user", SqlDbType.VarChar, 50),
new SqlParameter("@tel", SqlDbType.VarChar, 50),
new SqlParameter("@mobile", SqlDbType.VarChar, 50),
new SqlParameter("@email", SqlDbType.VarChar, 50),
new SqlParameter("@connectaddress", SqlDbType.VarChar, 120),
new SqlParameter("@zipcode", SqlDbType.VarChar, 12),
new SqlParameter("@water", SqlDbType.Bit),
new SqlParameter("@elec", SqlDbType.Bit),
new SqlParameter("@gas", SqlDbType.Bit),
new SqlParameter("@net", SqlDbType.Bit)
 }; parms[0].Value = house.InfoTypeId;
parms[1].Value = house.address;
parms[2].Value = house.WuYeTypeId;
parms[3].Value = house.expierdate;
parms[4].Value = 0;
parms[5].Value = house.owner;
parms[6].Value = house.posttime;
parms[7].Value = house.rent;
parms[8].Value = house.chargetypeid;
parms[9].Value = house.areaid;
parms[10].Value = house.circleid;
parms[11].Value = house.localityid;
parms[12].Value = house.square;
parms[13].Value = house.DecorationType;
parms[14].Value = house.shi;
parms[15].Value = house.ting;
parms[16].Value = house.wei;
parms[17].Value = house.bus;
parms[18].Value = house.floor;
parms[19].Value = house.buildingtall;
parms[20].Value = house.housepic;
parms[21].Value = house.hxpic;
parms[22].Value = house.description;
parms[23].Value = house.connection_user;
parms[24].Value = house.tel;
parms[25].Value = house.mobile;
parms[26].Value = house.E_mail;
parms[27].Value = house.ConnectionAddress;
parms[28].Value = house.zip;
parms[29].Value = house.water;
parms[30].Value = house.elec;
parms[31].Value = house.gas;
parms[32].Value = house.network;
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text; cmd.CommandText = strSQL.ToString(); foreach(SqlParameter parm in parms)
cmd.Parameters.Add(parm); using (SqlConnection conn = new SqlConnection(ConnectionString))
{
conn.Open();
cmd.Connection = conn;
cmd.ExecuteNonQuery();
}

}
********************************************************************是不是因为StringBuilder字符串太长了,不知与多次 .Append()有关否?帮我看一下吧!始终找不到原因

解决方案 »

  1.   

    http://www.google.com/search?hl=en&q=+%E5%8F%91%E7%94%9F%E7%B1%BB%E5%9E%8B%E4%B8%BA+System.StackOverflowException+%E7%9A%84%E5%BC%82%E5%B8%B8&btnG=Google+Search多用搜索
      

  2.   

    建议从开始加个断点,整个程序加上个try{}catch{},调试看看是具体是什么地方出的错
      

  3.   

    谢谢楼上的回复,问题已解决:错误在Model层的小失误public int ting
    {
    get {return this.ting;}   // 改成 return this._ting就对
    set {this._ting = value;}
    }