title: Not able to escape apostrophe/special characters in parameterized query
body: <p>RESOLVED: The data was being read from a Gridview which had the html encoding. The solution was the following...
      Dim Sht_Text As String = <strong>HttpUtility.HtmlDecode</strong>(row.Cells.Item(0).Text) </p>
  
  <p>I am trying to prevent from having to escape apostrophes and other special characters in my string variables by using a parameterized query with an <code>OleDbConnection</code>. I have all of the parameters in the same order, the insert is working, it just does not maintain the characters. I keep getting those pesky html codes. Any help would be appreciated. I am trying to insert into an Access db from a web pages. As I mentioned, its working, just not the special characters.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>Dim pConn As New OleDb.OleDbConnection pConn = New OleDbConnection(cb.ConnectionString)  
  Dim SqlString As String = "INSERT INTO Strings (Mlt_String_ID, Lng_ID, Strg_Name, Sht_Text, Lng_Text, Alt_Text) Values (?, ?, ?, ?, ?, ?)"  
  
  Using cmd As New OleDbCommand(SqlString, pConn)     
      cmd.CommandType = CommandType.Text     
      cmd.Parameters.AddWithValue("@Mlt_String_ID", Mlt_String_ID)
      cmd.Parameters.AddWithValue("@Lng_ID", Lng_ID)
      cmd.Parameters.AddWithValue("@Strg_Name", Strg_Name)
      cmd.Parameters.AddWithValue("@Sht_Text", Sht_Text)
      cmd.Parameters.AddWithValue("@Lng_Text", Lng_Text)
      cmd.Parameters.AddWithValue("@Alt_Text", Alt_Text)
  
      pConn.Open()
      cmd.ExecuteNonQuery()
      pConn.Close()
  End Using 
  </code></pre>
  
  <p>Updated example: This is directly from the access table after Insert.</p>
  
  <pre><code>String_ID String_Name  Long_Text  Short_Text  Alternate_Text Multi_String_ID Lang
  
  993       U_&amp;#176;C_fr &amp;#176;C    &amp;#176;C     &amp;#176;C        651             fr
  
  652       U_°C_jp      °C         °C          °C             651             jp
  
  651       U_°C         °C         °C          °C             651             en
  </code></pre>
  
  <p>jp and en records already existed, the insert of fr record pushes the html codes for the small circle which represents the degree symbol. Happens for all other special characters as well.</p>