title: asp.net - how to display a field from data row that is in html format
body: <p>I have a field of text in html format, in a row of data that I need to select and then display it in a aspx page as html.</p>
  
  <p>The text contains html tags, symbols like &amp; ; etc... and of course lots of double quotes. For example....</p>
  
  <pre><code>&lt;li&gt;products&lt;/li&gt;Check out our full line of these products, bla bla bla....&lt;br&gt;&lt;a href="http://www.thiswebsite3223.com/thispage.aspx" target="_blank"&gt;&lt;font color="blue"&gt;View&lt;/font&gt;&lt;/a&gt;&lt;td bgcolor="#000000" align="center"&gt;&lt;b&gt;&lt;font color="#FFFFFF"&gt;Diameter&lt;/font&gt;&lt;li&gt;30&amp;deg; Helix&lt;li&gt;&lt;/td&gt;
  </code></pre>
  
  <p>...etc</p>
  
  <p>The method that I am trying to use to retrieve it with in the codebehind, gives me the error...</p>
  
  <blockquote>
    <p>An exception of type 'System.Data.SqlClient.SqlException' occurred in
    System.Data.dll but was not handled in user code
         Additional information: Incorrect syntax near '='.</p>
  </blockquote>
  
  <pre><code>    public void GetHtml()
      {
          string gethtml = Request.QueryString["product"];
          string conString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
          string query = "SELECT htmlpull FROM ejn_html WHERE newseries LIKE = @gethtml";
          SqlCommand cmd = new SqlCommand(query);
          cmd.Parameters.Add("@gethtml", SqlDbType.VarChar, 70).Value = gethtml;
          SqlConnection con = new SqlConnection(conString);
          SqlDataAdapter sda = new SqlDataAdapter();
          cmd.Connection = con;
          sda.SelectCommand = cmd;
          DataTable dt2 = new DataTable();
          sda.Fill(dt2);
  
          foreach (DataRow dtRow in dt2.Rows)
          {
              pulledhtml = dtRow[0].ToString();
          }
  
      } 
  </code></pre>
  
  <p>The exception is triggered on the line that contains... <code>sda.Fill(dt2);</code> </p>
  
  <p>In my aspx page I try to call the variable using...</p>
  
  <pre><code>&lt;%= pulledhtml %&gt;
  </code></pre>
  
  <p>This works fine when I try to retrieve any other string variables that contain normal alphanumeric characters. This is a very large database that I inherited and I am not allowed nor would I want to edit the html in those fields. </p>
  
  <p>How can I retrieve this html code and display it without exception errors?   </p>