当前位置: 代码迷 >> ASP.NET >> 在统计记录数时报错解决办法
  详细解决方案

在统计记录数时报错解决办法

热度:2900   发布时间:2013-02-25 00:00:00.0
在统计记录数时报错
string constr = ConfigurationManager.ConnectionStrings["gsbConnectionString"].ConnectionString;
  SqlConnection con = new SqlConnection(constr);
  int maiid = Int32.Parse(ddlP.SelectedValue.ToString());
  string selconunt = "select count(pname) from plname where fid='" + maiid + "'";
  con.Open();
  SqlCommand cmd = new SqlCommand(selconunt,con);  
   
  int count =cmd.ExecuteScalar();//有错误吗?
  con.Close();


  if (count>0)
   
  Response.Write("<script>alert('存在子类,无法删除!')</script>");
我在代码中已经标注了,该地方报错,是什么原因,请大家指点,谢谢!

------解决方案--------------------------------------------------------
怎么两个帖子一样的
另外一个我也回答了
  相关解决方案