title: Insert String value into Database C#
body: <p>I've got my passwords to be hashed in my ASP.NET Webforms.</p>
  
  <p>How do I then enter the hashed password into the database via a string?</p>
  
  <pre><code>SqlConnection dbCon = new SqlConnection(ConfigurationManager.ConnectionStrings["ConMotorstore"].ConnectionString);
  
  dbCon.Open();
  
  SqlCommand cmd = new SqlCommand("INSERT INTO [user] VALUES (@firstName, @surname, @email, @username, @passwordHash)", dbCon);
  
  cmd.Parameters.AddWithValue("firstName", firstNameTxt.Text);
  cmd.Parameters.AddWithValue("surname", surnameTxt.Text);
  cmd.Parameters.AddWithValue("email", emailTxt.Text);
  cmd.Parameters.AddWithValue("username", usernameTxt.Text);
  
  string passwordHash = BCrypt.Net.BCrypt.HashPassword(passwordTxt.Text);
  cmd.Parameters.ToString("passwordHash");
  
  cmd.ExecuteNonQuery();
  </code></pre>
  
  <p>I knew I couldn't use <code>.AddWithValue</code> and thought of <code>.ToString</code> may have been the one to use.</p>
  
  <p>I am new to C#.</p>
  
  <p>Thanks.</p>