Esempio n. 1
0
        public static List <Exm> GetAllExams()
        {
            List <Exm> exams = new List <Objects.Exam>();

            using (SqlConnection con = new SqlConnection(DBConnection.ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("Proc_Exam_GetAll", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    SqlDataReader reader = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Exm exam = Exm.Populate(reader);
                        exams.Add(exam);
                    }
                }
            }
            return(exams);
        }