title: How to calculate how many times a specific substring appears in a database
body: <p>My Access database data looks like:</p>
  
  <pre><code>srno       likes
  user 1     001,002,003
  user 2     001,004,005,007
  user 2     001,007,009,001
  etc
  </code></pre>
  
  <p>I want to calculate how many times each individual value in the <code>likes</code> column, i.e. <code>001</code>, <code>002</code>, etc, appears in the table.</p>
  
  <p>I used this code:</p>
  
  <pre><code> cnn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &amp; Server.MapPath("App_Data\Acetech.mdb"))
          cnn.Open()
          msg = "SELECT COUNT(001) FROM (productfeedback) WHERE three like '001' OR second like '001' "
  
          cmd = New OleDbCommand(msg, cnn)
          str = cmd.ExecuteScalar()
  
          cnn.Close()
  </code></pre>
  
  <p>It should display <code>001 4</code>:</p>
  
  <pre><code>    If str Is DBNull.Value Then
          Label12.Text = "0"
      Else
          Label12.Text = Format(CStr(TextBox2.Text)) &amp; Convert.ToInt32(str)
      End If
  </code></pre>