예제 #1
0
        private void CloseAllOpenConnections(LinqDataContext ctx)
        {
            ctx.Log = new StringWriter();

            if (ctx.DatabaseExists())
            {
                //drop all connections by disabling multi-user (and immediatly abort all current transactions)
                ctx.ExecuteCommand("ALTER DATABASE " + _databaseName + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE");
                //re-enable multi-user
                ctx.ExecuteCommand("ALTER DATABASE " + _databaseName + " SET MULTI_USER");
            }
        }
예제 #2
0
        private void CloseAllOpenConnections(LinqDataContext ctx)
        {
            ctx.Log = new StringWriter();

            if (ctx.DatabaseExists())
            {
                //drop all connections by disabling multi-user (and immediatly abort all current transactions)
                ctx.ExecuteCommand("ALTER DATABASE " + _databaseName + " SET SINGLE_USER WITH ROLLBACK IMMEDIATE");
                //re-enable multi-user
                ctx.ExecuteCommand("ALTER DATABASE " + _databaseName + " SET MULTI_USER");
            }

        }