try catch 捕捉异常信息问题
public void update(string str,string No)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["con"]);
try
{
con.Open();
string sql = "update B_AttachmentType set Ratio='" + str + "' where AttachmentTypeID='" + No + "'";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.ExecuteNonQuery();
}
catch (Exception x)
{
throw (x);
}
}
如以上代码,加入了try catch ,但是遇到错误时页面还是报错,怎样是页面不报错,继续执行
catch里面怎样写代码?