public void Insert(NguyenNhanDto dto) { string query = "INSERT INTO NGUYENNHAN VALUES('" + dto.MaNguyenNhan + "','" + dto.TenNguyenNhan + "')"; _provider.executeQuery(query); }
public ArrayList GetDanhSachNguyenNhan() { ArrayList arr = new ArrayList(); NguyenNhanDto dto; OleDbDataReader reader = (OleDbDataReader)dao.GetDanhSachNguyenNhan(); while (reader.Read()) { dto = new NguyenNhanDto(); dto.MaNguyenNhan = reader["MaNguyenNhan"].ToString(); dto.TenNguyenNhan = reader["TenNguyenNhan"].ToString(); arr.Add(dto); } reader.Close(); return arr; }
public NguyenNhanDto GetNguyenNhan(string str) { NguyenNhanDto dto; OleDbDataReader reader = (OleDbDataReader)dao.GetDanhSachNguyenNhan(); while (reader.Read()) { dto = new NguyenNhanDto(); dto.MaNguyenNhan = reader["MaNguyenNhan"].ToString(); dto.TenNguyenNhan = reader["TenNguyenNhan"].ToString(); if (dto.MaNguyenNhan == str) reader.Close(); return dto; } reader.Close(); return null; }