title: c# Using Parameters.AddWithValue in SqlDataAdapter
body: <p>How can I use Parameters.AddWithValue with an SqlDataAdapter. Below searching codes.</p>
  
  <pre><code>var da = new SqlDataAdapter("SELECT * FROM annotations WHERE annotation LIKE '%"+txtSearch.Text+"%'", _mssqlCon.connection);
  var dt = new DataTable();
  da.Fill(dt);
  </code></pre>
  
  <p>I rewrote the code like this:</p>
  
  <pre><code>SqlDataAdapter da;
  da = new SqlDataAdapter("SELECT * FROM annotations WHERE annotation LIKE '%@search%'", _mssqlCon.connection);
  da.SelectCommand.Parameters.AddWithValue("@search",txtSearch.Text);
  var dt = new DataTable();
  da.Fill(dt);
  </code></pre>
  
  <p>but it failed.</p>