In my experience with the computers, the passcode does not reset when the computer has been reset, it is probably stored somewhere that is not affected by the computer reset. But if you had your battery disconnected overnight then you definately rest the computer
really doesn't matter which you disconnect. either one disrupts the flow of current from the vehicle. safety dictates that you disconnect the negative post first on negatively grounded vehicles to prevent accidentally shorting the positive to the chassis. allow a few minutes to reset the computer before hooking up the battery again.