title: The data types text and varchar are incompatible in the equal to operator in C#
body: <p>I am trying to access the data <code>empname</code> from the employeeTable, but the code I have written is giving me the following error: </p>
  
  <blockquote>
    <p>The data types text and varchar are incompatible in the equal to operator.</p>
  </blockquote>
  
  <p>Please suggest a solution </p>
  
  <pre><code>private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  {
      string Connection = "Data Source=(local);Initial catalog=Test;Integrated Security=true";
      string Query = "SELECT * FROM  EmployeeTable WHERE empname='" + comboBox1.Text + "' ;";
  
      SqlConnection conn = new SqlConnection(Connection);
      SqlCommand cmd = new SqlCommand(Query, conn);
  
      conn.Open();
      SqlDataReader reader = cmd.ExecuteReader();
  
      while (reader.Read())     
      {
          textBoxEmpName.Text = reader["EmpName"].ToString();
      }
  }
  </code></pre>