public Room getRoomByID(string rID) { DataTable dtInput = rDB.getByID(rID); Room r = new Room(); DateTime d = DateTime.Now; foreach (DataRow dr in dtInput.Rows) { string ID = (dr["roomID"]).ToString(); // Beware of the possible conversion errors due to type mismatches int status; if (checkStatus(ID, d)) { status = 1; } else { status = 0; } int num = (int)dr["numPerson"]; string type = dr["roomtypeID"].ToString(); r = new Room(ID, status, num, type); } return(r); }