private bool CheckUsername() { var conn = SQLHelpers.GetConnection(); conn.Open(); var command = new SqlCommand("SELECT * FROM Bruger WHERE Brugernavn=@brugernavn", conn); command.Parameters.AddWithValue("@brugernavn", UserNameTextBox.Text); using (var reader = command.ExecuteReader()) { if (reader.Read()) { conn.Close(); return(false); } } return(true); }