Mercedez benz transmissoin

a while ago we were stuck in the middle of a busy highway. the reason we were stuck was beacuse the transmisson on my sunts 2002 mercedez E430 wont engauge in D or in any other gear. why did this happened. like when i pushed the accelarator it it would feel like it was in neutral and the check engine light came on too. to make it work we turned off the car then turned it back on but we would only move about 100 ft then it would slip into nuetral why does this happen

thanks

My guess would be the transmission linkage or a computer problem if the transmission is computer controlled.

i think it might be the computer beacause everytime it happens the check engine light turns on.