public CommonHouse getRelatedCommonHouse() { if (!isValid(new List<string>() { "prID", "vName", "vBoundary", "vInUse" })) return null; string sqlCommand = String.Format("select chID from CommonHouse where vID={0}", vID); Sql sql = new Sql(); SqlDataReader reader = sql.selectCommonHouseIDByVID(sqlCommand); if (reader.HasRows) { reader.Read(); int commonHouseID = Int32.Parse(reader[0].ToString()); CommonHouse commonHouse = new CommonHouse(); commonHouse.id = commonHouseID; commonHouse.select(); return commonHouse; } else { return null; } }