Exemplo n.º 1
0
        public void Execute(SqlConnection connection, IScriptExecuteCallback callback)
        {
            if (runState != ScriptRunState.None)
            {
                throw new InvalidOperationException("Already Run");
            }

            SqlCommand command = connection.CreateCommand();

            command.CommandText    = commandText;
            command.CommandType    = CommandType.Text;
            command.CommandTimeout = 0;

            runState = ScriptRunState.Running;
            try
            {
                ExecuteCommand(command);
                runState = ScriptRunState.Succeeded;
            }
            catch (SqlException ex)
            {
                exception = ex;
                callback.Error(this, ex);
                runState = ScriptRunState.Failed;
            }
        }
Exemplo n.º 2
0
        public void Execute(SqlConnection connection, IScriptExecuteCallback callback)
        {
            if (runState != ScriptRunState.None)
                throw new InvalidOperationException("Already Run");

            SqlCommand command = connection.CreateCommand();
            command.CommandText = commandText;
            command.CommandType = CommandType.Text;
            command.CommandTimeout = 0;

            runState = ScriptRunState.Running;
            try
            {
                ExecuteCommand(command);
                runState = ScriptRunState.Succeeded;
            }
            catch(SqlException ex)
            {
                exception = ex;
                callback.Error(this, ex);
                runState = ScriptRunState.Failed;
            }
        }