SqlDataReader dr= cmd.ExecuteReader(CommandBehavior.CloseConnection)

这种写法可以直接在关闭了dr的时候对于connection也同时进行关闭~

相关文章: