title: How to resolve this error: The data types text and varchar are incompatible in the equal to operator?
body: <p>I have a table in microsoft sql server management studio named Userdetails with column name <code>[Email address]</code> that has datatype <code>varchar(50)</code>. Now, I am accessing this variable in jsp to compare this variable with another variable named <code>email2</code> whose datatype is text.Unfortunately, I am getting an error.</p>
  
  <p>This is only a part of my code. </p>
  
  <pre><code>String str=request.getParameter("email2");
  ResultSet rs = st.executeQuery("select [Email address],Username from Userdetails where [Email address]='" + str + "');
  </code></pre>