Exemplo n.º 1
0
        /// <summary>
        /// 关闭数据库连接
        /// </summary>
        public void CloseConnection()
        {
            //销毁Command
            if (dbCommand != null)
            {
                dbCommand.Cancel();
            }
            dbCommand = null;

            //销毁Reader
            if (dataReader != null)
            {
                dataReader.Close();
            }
            dataReader = null;

            //销毁Connection
            if (dbConnection != null)
            {
                dbConnection.Close();
            }
            dbConnection = null;
        }
Exemplo n.º 2
0
    //关闭数据库连接,每次测试结束的时候都调用关闭数据库连接
    public void CloseSQLConnection()
    {
        if (command != null)
        {
            command.Cancel();
        }

        if (reader != null)
        {
            reader.Close();
        }

        if (connection != null)
        {
            connection.Close();
        }

        command    = null;
        reader     = null;
        connection = null;

        print("已经断开数据库连接");
    }
    protected void Disconnect()
    {
        //销毁Command
        if (dbCommand != null)
        {
            dbCommand.Cancel();
        }
        dbCommand = null;

        //销毁Reader
        if (dataReader != null)
        {
            dataReader.Close();
        }
        dataReader = null;

        //销毁Connection
        if (dbConnection != null)
        {
            dbConnection.Close();
        }
        dbConnection = null;
    }
Exemplo n.º 4
0
 private void Finally(SqliteCommand command, SqliteDataReader reader = null)
 {
     command.Cancel();
     command.Dispose();
     reader?.Close();
 }
Exemplo n.º 5
0
 public void destroy()
 {
     mConnection.Close();
     mCommand.Cancel();
 }
Exemplo n.º 6
0
 // 【关闭数据库】
 public void CloseDataBase()
 {
     connection.Close();
     command.Cancel();
 }