在统计记录数时报错
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>");
我在代码中已经标注了,该地方报错,是什么原因,请大家指点,谢谢!
------解决方案--------------------
怎么两个帖子一样的
另外一个我也回答了