I solved it.
The problem was that when the user id was found in the mssql database and writen to the bruger.Text it added some empty spaces. I think it's the .ToString();that did this.
My solution was to write this line:
bruger.Text = bruger.Text.Replace(" ", "");
command.CommandText = "SELECT emailid from bruger WHERE bruger = @bruger";
globalvariables.Con.Open();
command.ExecuteScalar();
bruger.Text = command.ExecuteScalar().ToString();
bruger.Text = bruger.Text.Replace(" ", "");
globalvariables.Con.Close();