public List <lop> searchListLop(String search) { List <lop> list = new List <lop>(); String query; query = "Select * from lop where makhoa = '" + search + "' or lop.malop = '" + search + "' or lop.tenlop = '" + search + "'"; try { SqlCommand cmd = new SqlCommand(query, getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { lop l = new lop(); l.lopIDataReader(reader); list.Add(l); } reader.Close(); } catch (Exception e) { } return(list); }
public List <lop> getListLop() { List <lop> list = new List <lop>(); String query; query = "Select * from lop "; try { SqlCommand cmd = new SqlCommand(query, getConnection()); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { lop l = new lop(); l.lopIDataReader(reader); list.Add(l); } reader.Close(); } catch (Exception e) { } return(list); }