Using the small function, you can encrypt the password and store it in database and again when you need to compare the password, encrypt the password again that user typed and compare with previouly encrypted password.
Here is the code:
public static string EncryptPassword(string strPassword)
MD5CryptoServiceProvider p = new MD5CryptoServiceProvider();
byte arr = Encoding.UTF8.GetBytes(strPassword);
arr = p.ComputeHash(arr);
StringBuilder sb = new StringBuilder();
foreach (byte b in arr)