It all depends on how you store your passwords.
I usually do:
- Create a user with the password field set to nothing (not null).
- Insert the user into the database, thus generating the new UserID.
- Use the newly inserted UserID, plus some extra salt to generate the Password and store.
If you didn't used the UserID or a runtime generated (i.e. on insert) salt, then you can insert and encrypt the password at the same time.
Edit...
Sorry, I've inherited your use of Encrypt, however for a password, you "should" only ever HASH a password.
A simple example is:
md5(md5(UserID).md5('Password'))
Then, when the user types in their email/username and password, you simply need to so:
select * from User where Username = 'myusername' and Password = md5(concat(md5(UserID), md5('Password')))
instead of decrypting the password.