求帮忙
女孩坏坏 2012-05-16 08:45:41 为什么异常不能捕捉到?
try
{
if (RadioButton1.Checked)
{
string str = "select * from Book where BookName='" + this.TextBox1.Text + "'";
DataTable dt = DB.getdt(str);
if (dt.Rows.Count > 0)
{
Session["name"] = this.TextBox1.Text.Trim();
Response.Write("<script>location='shumu1.aspx';</script>");
}
}
else if (RadioButton2.Checked)
{
string str = "select * from Book where BookID='" + this.TextBox1.Text + "'";
DataTable dt = DB.getdt(str);
if (dt.Rows.Count > 0)
{
Session["id"] = this.TextBox1.Text;
Response.Write("<script>location='shumu.aspx';</script>");
}
}
}
catch (Exception ex)
{
Response.Write("<script>alert(" + ex.Message + ")</script>");
//Console.WriteLine("an error ourced");
}