If it is not the lock code, maybe it is the iPhone backup password. Have you set such an encryption on your backup while you sync your iPhone to iTunes? If so, try the backup password.
However, if it won't let you enter passcode, you can use a toll called [http://www.tenorshare.com/products/reiboot.html|Tenorshare ReiBoot]to put your iPhone into then out of recovery mode. This may fix the stuck screen.
Note: Don't hard reset your iPhone because it will erase all iPhone data and settings.