Dear mafa123,
Well, you like most of dummies here, you didn't fed 12V from outside power source to battery cables.
Nor didn't switch off your radio from it's power button, when disconnected the battery cables.
By switching radio off, capacitors inside of radio will save the mystical code...
You need to remove the radio from dash to get it's serial number, to get the code...