try catch
try
{
con.Open();
added = cmd.ExecuteNonQuery();
Label1.Text = "<b>操作提示:</b><br />";
Label1.Text += added.ToString() + "条记录被添加成功。";
Label1.Text += con.ServerVersion;
}
catch (Exception err)
{
Label1.Text = "<b>操作提示:</b><br />";
Label1.Text += err.Message;
}
finally
{
con.Close();
Label1.Text += "<b>操作提示:</b><br />";
Label1.Text += con.State.ToString();
}