两种写法:

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

 

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

大家常用的是哪个?

相关文章:

  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2022-01-15
  • 2022-02-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2021-06-11
相关资源
相似解决方案