本帖最后由 刘秋菊 于 2012-7-18 20:34 编辑
using (SqlConnection sqlCon = new SqlConnection("server = .; uid = sa ;pwd = 123456 ;database = BRC"))
{
sqlCon.Open();
using (SqlCommand cmd = sqlCon.CreateCommand ())
{
cmd.CommandText = "select * from pe_task";
using (SqlCommand cmd2 = sqlCon.CreateCommand ())
{
cmd2.CommandText = "select * from pe_task";
}
}
}
我的困惑:为什么程序执行完最里面一层using后,sqlCon的状态还是open?不是被释放了吗? |