public SWPTransactionDBConnection(
            SWPConnectionTextFormatType connectionTextFormatType,
            string connectionNameOrText)

        {
            _database = SWPDBHelper.DBConnection(
                connectionTextFormatType,
                connectionNameOrText);
            _connection = _database.CreateConnection();
            _connection.Open();
            _transaction = _connection.BeginTransaction();
        }
        private void ProcessCommand(
            string storedProcedureName,
            DataTable table,
            DataRowVersion dataRowVersion,
            DbParameter [] parameters)
        {
            string       candidateColumnName;
            bool         parmSet;
            Database     db = null;
            DbCommand    command;
            DbConnection conn = null;

            if (table == null)
            {
                return;
            }

            try
            {
                if (_dbTransactionConnection == null)
                {
                    db = SWPDBHelper.DBConnection(
                        _connectionTextFormatType,
                        _dbConnectionName);
                    command = db.GetStoredProcCommand(storedProcedureName);
                    conn    = db.CreateConnection();
                    conn.Open();
                    command.Connection = conn;
                }

                else
                {
                    command = _dbTransactionConnection.TransactionDatabase.GetStoredProcCommand(
                        storedProcedureName);
                }

                command.CommandType = CommandType.StoredProcedure;
                foreach (DataRow row in table.Rows)
                {
                    command.Parameters.Clear();
                    PopulateCommandWithParameters(command, parameters);
                    foreach (DbParameter commandParameter in command.Parameters)
                    {
                        parmSet = false;
                        // Skip the @ character
                        candidateColumnName = ColumnName(_dbConnectionName, commandParameter.ParameterName);

                        // we want to be case insensitive so lets
                        // do this by hand
                        foreach (DataColumn column in table.Columns)
                        {
                            if (String.Compare(
                                    column.ColumnName,
                                    candidateColumnName,
                                    true) == 0)
                            {
                                commandParameter.Value = row[column, dataRowVersion];
                                parmSet = true;

                                break;
                            }
                        }

                        if (!parmSet)
                        {
                            throw new Exception(
                                      "No matching column found for parameter: " +
                                      commandParameter.ParameterName);
                        }
                    }

                    command.ExecuteNonQuery();
                }
            }

            finally
            {
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }

                    conn = null;
                }
            }
        }