Bismillahi Al-Rahmani Al-Rahim

Question On Wudu And Salah

Q
As Salaam Alaikum

If someone makes Salah thinking he has wudoo and then when he is
finished after a long time realizes he did not have wudoo when he
made Salah, what should he do?  I realize that Rasulullah (peace and
blessings of Allah be upon him) said [to the close meaning] "there is
no Salah without Wudoo."  But in the hadith narrated by Muslim in his
Sahih, where it states that the Prophet (peace and blessings of Allah
be upon him) sent some people to look for a necklace that `Aa'ishah
had lost. The time for prayer came, and they prayed without wudoo'
(because they could not find water). When they came to the Prophet
(peace and blessings of Allah be upon him), they told him about it
and then the aayah of tayammum was revealed. (Sahih Muslim, 367). The
Prophet (peace and blessings of Allah be upon him) did not blame or
criticize them, neither did he tell them to repeat the prayer.

A
wa `alaykum al-salam wa rahmatullahi wa barakatuhu

When someone prays a prayer completely and later on determines that he did not actually have ritual purity when doing so, he needs to repeat the prayer. Al-Buhuti (may Allah be merciful with him) mentions this in Al-Raud al-murbi`  where Al-Hajjawi says in Zad al-mustaqni`,
Whoever sees filth upon himself after praying and is ignorant of whether it existed during the prayer, does not repeat the prayer. If he knows that the filth existed during the prayer but he was ignorant of or forgot it, he repeats the prayer (b: just as if someone were to pray while forgetting that purification had been invalidated).
T his, in sha Allah, answers the fiqh question.

And Allah knows best.

[References: Al-Raud al-murbi`, p63 of the Maktabat al-Bayan edition; Zad al-mustaqni`, section c2.11 in the lessons]

If we take all evidence into account, the first hadith is understood to apply to a general case where water is available for use. But it would not be applicable to cases where water is not available but dirt is, nor cases where neither water or dirt are available. All of these things are covered in fiqh books in the section concerning tayamumm.

The second hadith you mention is the second hadith that Imam Muslim (may Allah be pleased with him) mentioned in the chapter on Tayammum. Imams Al-Bukhari and Ibn Majah (may Allah be pleased with them) included it also; Imam Al-Bukhari mentioned it in the section concerning the merits of `A'ishah (Allah be pleased with her) as well as in the book of marriage as proof for lending out clothes for weddings.

Imam Al-Nawawi says that this hadith is evidence for those who say that someone lacking both water and dirt [still] prays in according to whatever his situation may be, and that on this matter there are differences of opinion among the earlier generations of Muslims and the later [al-salaf wa al-khalaf], with the strongest opinion being that it is obligatory to pray the prayer and it is not obligatory to later repeat it. (See Al-Minhaj Sharh Sahih Mulim ibn Al-Hajjaj, Dar Al-Ma`rifah edition, 4:282)

wa al-salamu `alaykum
--musa