[求助]关于try...catch....finally
看红色部份的代码?try{
conn.Open();
if (usingTransaction)
{
trans = conn.BeginTransaction();
cmd.Transaction = trans;
}
int affected = cmd.ExecuteNonQuery();
if (trans != null)
{
trans.Commit();
}
return affected; // 如果顺利执行完这行语句,还会执行其后面的finally块吗????
}
catch(SqlException ex)
{
if (trans != null)
{
trans.Rollback();
}
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
return -1;
}