One thing you can try is a memory minder gizmo. Basically it's a 9 volt battery on a plug that you stick in a power port/cigarette lighter. It's supposed to retain your radio settings (as well as any computer settings). Some auto parts stores carry them and they should cost around $20 or less.
I haven't played with one before. I've read that you need to make sure that the power port you plug it in to is hot all the time.
As far as the code goes, sometimes it's on a sticker on the radio itself, but it varies widely by make and model. And sometimes the sticker is on top, the side, on the back, etc. And sometimes there's no sticker at all.