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)); }
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); }