If you disconnect the battery, you need to also turn on your lights and press the horn. This will drain the residual voltage in the system holding the code. Remember if you disconnect the the battery, EVERYTHING gets reset, thus you'll have to retrain the transmission, and various other functions.