FUNCTION GetUpperMaleAncestor(nPerson) DO WHILE SEEK(nPerson,"FamilyTrees","MaleParent") nPerson = FamilyTrees.Person ENDDO RETURN nPersonNow retrieve all offspring of this person
FUNCTION RetrieveOffSpring(nPerson) CREATE CURSOR offSpring (Person I) SELECT FamilyTrees SET ORDER TO TAG MaleParent DO GetOffSpring(nPerson) SELECT * FROM FamilyTrees WHERE EXIST (SELECT Person FROM OffSpring) INTO CURSOR Result RETURN *- FUNCTION GetOffSpring(nPerson) LOCAL nRec nRec=RECNO() SEEK nPerson DO WHILE !EOF() AND MaleParent = nPerson INSERT INTO Offspring (Person) DO GetOffSpring (Person) SKIP ENDDO GO nRec RETURNO.K. Your turn to write the SQL example and the ADO.NET implementation (Good luck).