I'm going to assume you are referring to the lock screen passcode. If so, updating the iOS version should NOT cause a password to somehow get created, especially one in which you do not know. Having said that, if you do not know the passcode, we definitely do not know it, and therefore, you are going to have to connect your iPhone to your computer and then restore it via iTunes.