When the DS is off hold a+b and when it shows the DSs logo hold star+sel, hook it up to the computer and press "quick upgrade".
Actually if it suddenly deleted all your games and codes, without you doing it, then here's how you fix it (My AR deleted all my files, but i restored it): 1st, hold Select and Start at the same time, then turn the DS on. keep holding it until after the DS' top screen says "This product is not licensed or endorsed by Nintendo". Keep holding Start and Select until it fades a different shade of white, then wait for a second, then turn off the DS. Now try the AR.