title: Addslashes / escape single quote in .NET
body: <p>I'm maintaining a piece of code that concatenates SQL queries like:</p>
  
  <pre><code>string sql = "SELECT* FROM table WHERE column = '" + value + "'";
  </code></pre>
  
  <p>Now it turned out that if <strong>value</strong> contains <strong>'</strong> characted it will break SQL Server text statement. I searched a bit for method similar to PHP addslashes, but without success. There's <strong>Regex.Escape</strong> but it didn't do the trick. Is there any other way to address that issue except calling <strong>Replace</strong> method on string?:</p>
  
  <pre><code>string sql = "SELECT* FROM table WHERE column = '" + value.Replace("'", "''") + "'";
  </code></pre>
  
  <p>Thanks,
  Paweł</p>