本文介绍了关闭数据库连接...非常快速的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照主题行,这是一个非常快速的问题...

我在程序的各个位置都有类似的代码:

As per the Subject line, a very quick question ...

I have code similar to this in various places in my program :

If mySqlConn.State = ConnectionState.Closed Then mySqlConn.Open()
            Using mySqlRdr As SqlCeDataReader = mySqlCmd.ExecuteReader()
                mySqlCmd.ExecuteNonQuery()
                mySqlConn.Close()
                Me.Hide()
                MasterForm.Show()
            End Using



我刚刚注意到,尽管我总是在某些地方打开 mySqlConn ...,但我还是关闭了 MySqlConn &在某些地方,我关闭了 mySqlRdr ...我应该做什么,还是应该同时做这两个事情?!?



I''ve just noticed that although I always Open mySqlConn ... in some places I close MySqlConn & in some places I close mySqlRdr ... which should I be doing, or should I be doing both ?!?

推荐答案


这篇关于关闭数据库连接...非常快速的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 20:36