title: Cannot figure out how to fix syntax error (missing operator) in query expression error in C#
body: <p>I'm having an issue with an error written above and cannot find a exact way to fix it.</p>
  
  <pre><code>OleDbDataAdapter dataAdapter = new OleDbDataAdapter("Select count(*) from [contractors$] where " + category + " like '*@name*'", eh.Connection);
  dataAdapter.SelectCommand.Parameters.Add("@name", OleDbType.VarChar).Value = "*" + name + "*";
  OleDbCommand command = dataAdapter.SelectCommand;
  OleDbDataReader reader = command.ExecuteReader();
  </code></pre>
  
  <p>The exact error is..</p>
  
  <blockquote>
    <p>Syntax error (missing operator) in query expression 'like '<em>@name</em>''.</p>
  </blockquote>
  
  <p>I've also already looked for solutions to this problem and have attempted to adapt them to try to get this work work, but with no luck(the one above was one of the attempts)</p>
  
  <p>Much thanks in advance!</p>
  
  <p>Ok, so I have now change the code to this..</p>
  
  <pre><code>OleDbDataAdapter dataAdapter = new OleDbDataAdapter("Select count(*) from `contractors$` where " + category + " LIKE @name", eh.Connection);
  dataAdapter.SelectCommand.Parameters.Add("@name", OleDbType.VarChar).Value = "%" + name + "%";
  OleDbCommand command = dataAdapter.SelectCommand;
  OleDbDataReader reader = command.ExecuteReader();
  </code></pre>
  
  <p>But I am still getting the same error.</p>