asp如何跳过错误继续执行下面的代码
string Sql1 = "select T1 from book where booktime='" + TextBox1.Text + "'";
SqlCommand cmd1 = new SqlCommand(Sql1, connstring);
SqlDataReader dr1 = cmd1.ExecuteReader();
if (dr1.Read())
{
this.Label14.Text = dr1[0].ToString();
}
string st4 = Label14.Text.Trim();
Response.Write(Convert.ToDateTime(st4).ToString());
DateTime dt3 = Convert.ToDateTime(st4);
如果发生错误就跳过这段代码继续执行下面的代码
------解决方案--------------------try
{
//DoYourCore();
}
catch
{
}
//GoOn();
------解决方案--------------------try( SqlCommand cmd1 = new SqlCommand(Sql1, connstring);
SqlDataReader dr1 = cmd1.ExecuteReader();
if (dr1.Read())
{
this.Label14.Text = dr1[0].ToString();
}
)cath{
this.Labe14.Text=null;
}
------解决方案--------------------
try
{
}
catch
{
//执行有错到这里
}
------解决方案--------------------