Пример #1
0
        public void AdicionarParametro(string nombre, object valor, DireccionParametro direccion, TipoParametro tipo)
        {
            ParametroDTO parametro = new ParametroDTO();

            parametro.Nombre    = nombre;
            parametro.Direccion = direccion.ToString();
            parametro.Tipo      = tipo.ToString();
            parametro.Valor     = valor;
            arregloParametros.Add(parametro);
        }
Пример #2
0
        public static void AgregarParametro(DbCommand command, string parameterName, object parameterValue, TipoParametro parameterType, Direccion direction)
        {
            // create a new parameter
            DbParameter param = command.CreateParameter();

            param.ParameterName = parameterName;
            param.Value         = parameterValue;
            switch (parameterType.ToString().Trim().ToUpper())
            {
            case "INT":
            {
                param.DbType = DbType.Int32;
                break;
            }

            case "STR":
            {
                param.DbType = DbType.String;
                break;
            }

            case "DT":
            {
                param.DbType = DbType.DateTime;
                break;
            }

            case "BIT":
            {
                param.DbType = DbType.Byte;
                break;
            }

            case "DBL":
            {
                param.DbType = DbType.Double;
                break;
            }

            case "DCL":
            {
                param.DbType = DbType.Decimal;
                break;
            }
            }

            switch (direction.ToString().Trim().ToUpper())
            {
            case "INPUT":
            {
                param.Direction = ParameterDirection.Input;
                break;
            }

            case "OUTPUT":
            {
                param.Direction = ParameterDirection.Output;
                break;
            }

            case "INPUTOUTPUT":
            {
                param.Direction = ParameterDirection.InputOutput;
                break;
            }

            case "VALUE":
            {
                param.Direction = ParameterDirection.ReturnValue;
                break;
            }
            }

            command.Parameters.Add(param);
        }