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>");
我在代码中已经标注了,该地方报错,是什么原因,请大家指点,谢谢!
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>");
我在代码中已经标注了,该地方报错,是什么原因,请大家指点,谢谢!
解决方案 »
- 清理了一下注册表,vs2005新建网站报错,怎么解决!!
- 如何打開一個指定的网頁,隔5秒后便自動關閉此網頁,且网頁在關閉時不出現提示。
- 如何将textbox的多行数据一行行的添加到数据库中?
- 求段代码参数hashtable返回以value排序的hashtable(text还是不变)
- ImageUrl=' <%# DataBinder.Eval(Container.DataItem, "product_Page", "images/img{0}.gif") %>'
- 转换为数据类型为 int 的列时发生语法错误。
- )==(========================>js给文本框赋值
- 代码找错~~~求帮忙找一下错误~~
- 关于向access数据库内插入代自动编号数据的问题
- 怎样验证输入的时间不能早于当前日期(c#)(来者有分,决不食言)
- 如何让oledbdataadapter显示转换成oledbdataadapter
- 对DateTime类型值赋空值出错
你要不int count = Convert.ToInt32(cmd.ExecuteScalar());
要不int count = Int32.Parse(cmd.ExecuteScalar());