title: How to execute sql query to match column value which contains single quote(')
body: <p>My C# code to find a data row with column name CustomerAccountNumber which contains a value KKL'M&quot;/ (single quote ' in value) return nothing</p>
  <p>here is my C# code:</p>
  <pre><code>matchingid = &quot;KKL'M\&quot;/&quot;;
  bool foundCustomer = false;
  SqlConnection cnn;
  connetionString = &quot;Server=&quot; + config.serverName + &quot;;Database=&quot; + config.companyName + &quot;;Trusted_Connection=true&quot;;
  cnn = new SqlConnection(connetionString);
  cnn.Open();
  
  var queryString = &quot;SELECT CustomerAccountNumber, CustomerAccountName FROM [&quot; + config.companyName + &quot;].[dbo].[SLCustomerAccount] WHERE CustomerAccountNumber = @matchingAccountName&quot;;
  SqlCommand command = new SqlCommand(queryString, cnn);
  command.Parameters.Add(new SqlParameter(&quot;@matchingAccountName&quot;, System.Data.SqlDbType.NChar) { Value = matchingid });
  using (SqlDataReader reader = command.ExecuteReader())
  {
      while (reader.Read())
      {
         foundCustomer = true;
      }
  }
  cnn.Close();
  </code></pre>
  <p>screenshot of the database where value contains
  <a href="https://i.stack.imgur.com/h0Aan.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h0Aan.png" alt="enter image description here" /></a></p>