using (SqlConnection connection = new SqlConnection(connectionString))
{
using (SqlCommand cmd = new SqlCommand(SQLString, connection))
{
}
}
见天看了别人的源码!
不知道为什么要这样写!这样写的好处是什么呢?
...全文
1716打赏收藏
关于数据库连接,用using(sqlconnection sqc = new sqlconnection())的问题!
using (SqlConnection connection = new SqlConnection(connectionString)) { using (SqlCommand cmd = new SqlCommand(SQLString, connection)) { } } 见天看了别人的源码! 不知道为什么要这样写!这样写的好处是什么呢?