title: String comparison C# and SQL Server
body: <p>I am creating a web app in C# with connection to a SQL Server database.</p>
  
  <p>I need to compare data from database to string in my app and here is my problem.</p>
  
  <p>I suppose it is a problem with encoding so I tried few ways like functions <code>Normalize()</code>, few kinds of string comparisons but it's never been working.</p>
  
  <p>I had changed type in my database from <code>char</code> to <code>nvarchar</code> and it wasn't working too.</p>
  
  <p>Here is a piece of my code, do you have any ideas?</p>
  
  <pre><code>query = "SELECT status_name FROM quizgame.dbo.uzytkownicy AS u WHERE u.nazwa = @nazwa";
  cmd2 = new System.Data.SqlClient.SqlCommand(query, conn);
  
  if (String.IsNullOrEmpty(name))
      cmd2.Parameters.AddWithValue("@nazwa", DBNull.Value);
  else
      cmd2.Parameters.AddWithValue("@nazwa", name);
  
  object scalar2 = cmd2.ExecuteScalar();
  
  if(scalar2 != null)
      user_status = scalar2.ToString();
  </code></pre>
  
  <p>And when I try to compare two strings with method <code>Equals</code> which is completely the same the <code>bool</code> result is always false.</p>