title: String builder SELECT query when a variable has an apostrophe
body: <p>A colleague of mine has created a program that reads a text file and assigns various values from it to variables that are used in SQL statements.
  One of these variables, <code>gsAccounts</code> is a string variable.</p>
  
  <p>Using a string builder, a <code>SELECT</code> statement is being built up with <code>sql.append</code>. At the end of the string, there is the following line:</p>
  
  <pre><code>sql.Append(" WHERE L.Account_Code IN(" &amp; gsAccounts &amp; ")"
  </code></pre>
  
  <p>The problem that I'm having is that sometimes, not always, <code>gsAccounts</code> (a list of account codes) may contain an account code with an apostrophe, so the query becomes</p>
  
  <pre><code>"WHERE L.Account_Code IN('test'123')"
  </code></pre>
  
  <p>when the account code is <code>test'123</code></p>
  
  <p>I have tried using double quotes to get around it in a <code>"WHERE L.Account_Code IN("""" &amp; gsAccounts &amp; """")"</code> way (using 4 and 6 " next to each other, but neither worked)</p>
  
  <p>How can I get around this? The account_Code is the Primary Key in the table, so I can't just remove it as there are years worth of transactions and data connected to it.</p>