Example #1
0
        /// <summary>
        /// Constructor for a Query
        /// </summary>
        /// <param name="CmdText">The SQL command you wish to execute</param>
        /// <param name="Name">The name of the query</param>
        /// <param name="ConnectionString">The connection string that the query will be executed againsts</param>
        public Query(string CmdText, string Name, string ConnectionString)
        {
            if (CmdText.Length == 0) { throw new Exceptions.InvalidParameterException("Command Text cannot be zero length"); }
            if (Name.Length == 0) { throw new Exceptions.InvalidParameterException("Name cannot be zero length"); }

            sqlCon = new SqlConnection(ConnectionString);
            sqlCmd = new SqlCommand(CmdText, sqlCon);
            parameters = new ParameterCollection();
            name = Name;
        }
Example #2
0
        /// <summary>
        /// Constructor fot the parameter
        /// </summary>
        /// <param name="name">The name of the parameter</param>
        /// <param name="Val">The value of the parameter</param>
        /// <param name="Type">The type of parameter</param>
        /// <param name="Output">Determines if the parameter is of type output</param>
        public Parameter(string name, object Val, ParameterCollection.FieldType Type, bool Output)
        {
            if (name.Length == 0) { throw new Exceptions.InvalidParameterException("Name can not be zero length"); }

            _Type = Type;
            _Name = name;
            _Value = Val;
            _Output = Output;

            SetValue();
        }
Example #3
0
        public Query(string CmdText, Transaction transaction)
        {
            if (CmdText.Length == 0) { throw new Exceptions.InvalidParameterException("Command Text cannot be zero length"); }

            sqlCon = transaction.Connection;
            sqlTran = transaction.SqlTransaction;
            sqlCmd = new SqlCommand(CmdText, sqlCon);
            sqlCmd.Transaction = sqlTran;
            parameters = new ParameterCollection();
            name = "none";
        }
Example #4
0
        /// <summary>
        /// Sets the command text of the SqlCommand object
        /// </summary>
        /// <param name="CmdText">The SQL command you wish to execute</param>
        public void SetCommandText(string CmdText)
        {
            if (CmdText.Length == 0) { throw new Exceptions.InvalidParameterException("Command Text cannot be zero length"); }

            sqlCmd = new SqlCommand(CmdText, sqlCon);
            parameters = new ParameterCollection();
        }