Ejemplo n.º 1
0
 public Student()
 {
     if (dbHelper == null)
     {
         dbHelper = new ReaderDbHelper();
     }
 }
Ejemplo n.º 2
0
        public static Student GetStudentByName(string name)
        {
            DbDataReader reader =
                new ReaderDbHelper().ExecuteReader(@"SELECT * FROM Student WHERE [Name]=@Name",
                                                   new ReaderDbHelper().LongConnection, name);

            reader.Read();
            return(map(reader));
        }
Ejemplo n.º 3
0
        public static IList <Student> GetStudent(string name)
        {
            DbDataReader reader = new ReaderDbHelper().ExecuteReader($"SELECT * FROM Student",
                                                                     new ReaderDbHelper().LongConnection, name);
            //bool HasRow= reader.Read();
            IList <Student> students = new List <Student>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    students.Add(map(reader));
                }
            }
            return(students);
        }