public KhachHangThanThiet GetDataFromRowSelected(string ID) { _connect.open(); KhachHangThanThiet khtt = new KhachHangThanThiet(); string sql; sql = string.Format("SELECT * FROM KHACHHANGTHANTHIET WHERE MaKhachHang = '{0}'", ID); SqlDataReader reader = _connect.GetDataFromRowSelected(sql); while (reader.Read()) { khtt.MaKhachHang = reader[0].ToString(); khtt.HoTen = reader[1].ToString(); khtt.DiaChi = reader[2].ToString(); khtt.CMND = reader[3].ToString(); khtt.NgayCapThe = Convert.ToDateTime(reader[4].ToString()); khtt.DiemThuong = Convert.ToInt32(reader[5].ToString()); } _connect.close(); return(khtt); }