.Net关闭数据库连接时判断ConnectionState为Open还是Closed?

两种写法:

if (conn.State == System.Data.ConnectionState.Open)
            {
                conn.Close();
            }

if (conn.State != System.Data.ConnectionState.Closed)
            {
                conn.Close();
            }

大家常用的是哪个?

上一篇:下拉选择框 Spinner的用法。


下一篇:UVA 11292 - The Dragon of Loowater (water)