Arabic text
عَنْ أَبِي هُرَيْرَةَ رضي الله عنه أَنَّ رَسُولَ اللهِ صلى الله عليه وسلم قَالَ: «إِذَا مَاتَ الْإِنْسَانُ انْقَطَعَ عَنْهُ عَمَلُهُ إِلَّا مِنْ ثَلَاثَةٍ: إِلَّا مِنْ صَدَقَةٍ جَارِيَةٍ، أَوْ عِلْمٍ يُنْتَفَعُ بِهِ، أَوْ وَلَدٍ صَالِحٍ يَدْعُو لَهُ».
Translation
Abu Hurayrah (may Allah be pleased with him) reported: The Messenger of Allah (may Allah's peace and blessings be upon him) said: "When a person dies, his deeds come to an end except for three things: ongoing charity, beneficial knowledge, or a pious child who supplicates for him."
Explanation
The Prophet (may Allah's peace and blessings be upon him) informed that the deeds of a person come to a halt when he dies. No good deeds are recorded for him after death, except for these three things, as he was the cause behind them: First: Charity whose reward is enduring, permanent, and ceaseless, like endowment, building mosques, digging wells, etc. Second: Knowledge from which people draw benefits, like authoring books of knowledge or teaching knowledge to someone, who in turn disseminates this knowledge after his teacher's death. Third: A pious, believing child who supplicates for his parents.
Source: HadeethEnc.com