title: Error in Like operator and escaping special characters
body: <p>I'm getting the exception: </p>
  
  <blockquote>
    <p>Error in Like operator: the string pattern 'Blah [Blah Blah]' is invalid.</p>
  </blockquote>
  
  <p>It's occurring where I'm using a datatable's <code>Select</code> method like so:</p>
  
  <pre><code>DataRow[] rows = table.Select("X Like '" + y + "'");
  </code></pre>
  
  <p>I've seen from reading other posts that it's the square brackets.  The posts I've read say to escape the squares brackets but most of them focus on the source of the problem being a hard coded string the developer can easily escape.</p>
  
  <p>I'm reading the data in from a database.  I could do something like <code>y.replace("[", "\\[")</code> which I'm guessing would fix the issue for square brackets.  But then I'm wondering, what if elsewhere in the DB there is a string with an * etc.</p>
  
  <p>How do others deal with this?  Can I call something that will make a string safe by escaping all possibly illegal characters or is it a case of manually replacing them with escaped equivalents?</p>