Example #1
0
        public void ExecuteStoredProcedure(string name, ValuedParameterCollection parameters)
        {
            IDbCommand cmd = _Driver.CreateCommand(name, _Connection, CommandType.StoredProcedure);
            foreach (ValuedParameter parameter in parameters)
            {
                IDbDataParameter p = _Driver.CreateParameter(parameter.Name, parameter.Value, parameter.DbType, parameter.Direction);
                cmd.Parameters.Add(p);
            }

            cmd.Connection.Open();
            try
            {
                cmd.ExecuteNonQuery();
                foreach (ValuedParameter parameter in parameters)
                {
                    if (parameter.Direction == ParameterDirection.InputOutput)
                        parameter.Value = ((IDbDataParameter)cmd.Parameters[_Driver.FormatParameter(parameter.Name)]).Value;
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                cmd.Connection.Close();
            }
        }
Example #2
0
 /// <summary>
 /// Adds the elements of another ValuedParameterCollection to the end of this ValuedParameterCollection.
 /// </summary>
 /// <param name="items">
 /// The ValuedParameterCollection whose elements are to be added to the end of this ValuedParameterCollection.
 /// </param>
 public virtual void AddRange(ValuedParameterCollection items)
 {
     foreach (ValuedParameter item in items)
     {
         this.List.Add(item);
     }
 }
Example #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="collection"></param>
 public Enumerator(ValuedParameterCollection collection)
 {
     this.wrapped = ((CollectionBase)collection).GetEnumerator();
 }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the ValuedParameterCollection class, containing elements
 /// copied from another instance of ValuedParameterCollection
 /// </summary>
 /// <param name="items">
 /// The ValuedParameterCollection whose elements are to be added to the new ValuedParameterCollection.
 /// </param>
 public ValuedParameterCollection(ValuedParameterCollection items)
 {
     this.AddRange(items);
 }