Start by looking at this:
Password Storage: How to do it.[
^] - it doesn't cover storing or retrieving the data from teh dtabase, but that is the trivial bit:
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("SELECT password FROM myTable WHERE username=@UN", con))
{
cmd.Parameters.AddWithValue("@UN", txtUserName.Text);
using (SqlDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
byte[] psw = (byte[])reader["password"];
...Check as in the Tip
}
}
}
}