Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data;
- using System.Data.SqlClient;
- using ENTIDADES;
- using System.Web;
- using System.Web.Configuration;
- namespace DAO
- {
- public class DAOCategoria
- {
- private string cadena;
- public DAOCategoria()
- {
- cadena = WebConfigurationManager.ConnectionStrings["cadena"].ConnectionString;
- }
- public List<eCategoria> ListarTodo()
- {
- SqlConnection con = new SqlConnection(cadena);
- SqlCommand cmd = new SqlCommand("SP_CATEGORIA_LISTAR_TODO", con);
- List<eCategoria> lista = new List<eCategoria>();
- con.Open();
- SqlDataReader lector = cmd.ExecuteReader();
- while (lector.Read())
- {
- eCategoria p = new eCategoria();
- p.IdCategoria = lector.GetInt32(0);
- p.NombreCat = lector.GetString(1);
- lista.Add(p);
- }
- con.Close();
- return lista;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment