Beispiel #1
0
    public List<cabecera> getCabeceras(string rango)
    {
        dc = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["ePlaceDBConnectionString"].ConnectionString);

        cabecera item = new cabecera();
        SqlCommand command = new SqlCommand();
        command.Connection = dc;
        command.CommandType = CommandType.StoredProcedure;
        using (dc)
        {
            try
            {
                dc.Open();
                var parametros = new SqlParameter[]
                                 {
                                      new SqlParameter
                                         {
                                             SqlDbType = SqlDbType.VarChar,
                                             Direction = ParameterDirection.Input,
                                             ParameterName = "@rango",
                                             Value = rango
                                         }
                                 };
                //IDataReader lector;

                command.Parameters.AddRange(parametros);
                command.CommandText = "SOCG_ejecutaCabecera";
                lector = command.ExecuteReader();

                List<cabecera> cab = new List<cabecera>();

                while (lector.Read())
                {
                    cab.Add(item.castDR(lector));
                }

                lector.Close();
                dc.Dispose();
                return cab;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
Beispiel #2
0
        public List<cabecera> getCabeceras(string rango)
        {
            SqlParameter[] param = new SqlParameter[1];
            cabecera item = new cabecera();

            param[0] = new SqlParameter("@rango", rango);

            datosSQL.ConGenerico = false;
            datosSQL.Parametros = param;
            datosSQL.Stored = "SOCG_ejecutaCabecera";
            lector = ebSQL.ExecuteSPReader(datosSQL);

            List<cabecera> cab = new List<cabecera>();

            while (lector.Read())
            {

                cab.Add(item.castDR(lector));
            }

            lector.Close();
            return cab;
        }