以下选项中哪一个更好?
只使用一个 using 语句是否足够?
选项1:
using(SqlConnection con = new SqlConnection(constring))
{
using(SqlCommand cmd = new SqlCommand())
{
.........................
.........................
.........................
}
}
选项2:
using(SqlConnection con = new SqlConnection(constring))
{
SqlCommand cmd = new SqlCommand();
.........................
.........................
.........................
}