Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void HelloWorld()
- {
- var Lista = new List<Atributos>();
- using (var con = new SqlConnection(cnn))
- {
- var cmd = new SqlCommand("SELECT * FROM ASIGNATURA", con) { CommandType = CommandType.StoredProcedure };
- con.Open();
- var dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- var hambre = new Atributos
- {
- iD = Convert.ToInt32(dr[0].ToString()),
- Nombre = dr[1].ToString(),
- Credito = Convert.ToInt32(dr[2].ToString())
- };
- Lista.Add(hambre);
- }
- }
- var js = new JavaScriptSerializer();
- Context.Response.Write(js.Serialize(Lista));
- }
- public class Atributos
- {
- public int iD { get; set; }
- public string Nombre { get; set; }
- public int Credito { get; set; }
- }
Add Comment
Please, Sign In to add comment