/// <summary>
        /// Gets the queue that has the given name from the database
        /// </summary>
        /// <param name="name">The name of the queue you want</param>
        /// <returns>The queue</returns>
        public INamedQueue GetQueue(string name)
        {
            INamedQueue retqueue = null;

            using (var conn = SqlHelper.CreateSqlConnection(NameOrConnectionString))
            {
                conn.Open();
                using (var command = new SqlCommand())
                {
                    command.Connection = conn;
                    command.Parameters.Add("@name", SqlDbType.NVarChar, 63).Value = name;
                    command.CommandText = GetSelectQueueSql();
                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            reader.Read();
                            retqueue =
                                new SqlNamedQueue(reader.GetString(1), reader.GetInt32(0), this);
                        }
                    }
                }
            }
            return(retqueue);
        }
        /// <summary>
        /// Creates a new queue with the given name
        /// </summary>
        /// <param name="name">The name you want for the queue</param>
        /// <returns>The queue you have just created</returns>
        public INamedQueue CreateQueue(string name)
        {
            INamedQueue queue;

            using (var conn = SqlHelper.CreateSqlConnection(NameOrConnectionString))
            {
                conn.Open();
                using (var commandInsert = new SqlCommand())
                {
                    commandInsert.Parameters.Add("@queuename", SqlDbType.NVarChar).Value = name;
                    commandInsert.CommandText = GetInsertQueueSql();
                    commandInsert.Connection  = conn;
                    using (var reader = commandInsert.ExecuteReader())
                    {
                        reader.Read();
                        queue = new SqlNamedQueue(name, (int)reader.GetDecimal(0), this);
                    }
                }
            }
            return(queue);
        }
 /// <summary>
 /// Gets the queue that has the given name from the database
 /// </summary>
 /// <param name="name">The name of the queue you want</param>
 /// <returns>The queue</returns>
 public INamedQueue GetQueue(string name)
 {
     INamedQueue retqueue = null;
     using (var conn = SqlHelper.CreateSqlConnection(NameOrConnectionString))
     {
         conn.Open();
         using (var command = new SqlCommand())
         {
             command.Connection = conn;
             command.Parameters.Add("@name", SqlDbType.NVarChar, 63).Value = name;
             command.CommandText = GetSelectQueueSql();
             using (var reader = command.ExecuteReader())
             {
                 if (reader.HasRows)
                 {
                     reader.Read();
                     retqueue =
                         new SqlNamedQueue(reader.GetString(1), reader.GetInt32(0), this);
                 }
             }
         }
     }
     return retqueue;
 }
 /// <summary>
 /// Creates a new queue with the given name
 /// </summary>
 /// <param name="name">The name you want for the queue</param>
 /// <returns>The queue you have just created</returns>
 public INamedQueue CreateQueue(string name)
 {
     INamedQueue queue;
     using (var conn = SqlHelper.CreateSqlConnection(NameOrConnectionString))
     {
         conn.Open();
         using (var commandInsert = new SqlCommand())
         {
             commandInsert.Parameters.Add("@queuename", SqlDbType.NVarChar).Value = name;
             commandInsert.CommandText = GetInsertQueueSql();
             commandInsert.Connection = conn;
             using (var reader = commandInsert.ExecuteReader())
             {
                 reader.Read();
                 queue = new SqlNamedQueue(name, (int)reader.GetDecimal(0), this);
             }
         }
     }
     return queue;
 }