title: How to check if value exists in a database or not
body: <p>I want code in VB to check if values in a database exist or not.</p>
  
  <p>Here is my code</p>
  
  <pre><code>conn.open()
  Dim select As New OleDbCommand
  
  select.Connection = conn
  
  select.CommandText = " SELECT COUNT(*) FROM your_table WHERE field = textbox.value"
  if count&gt;0
  MsgBox("already exists")
  
  conn.close()
  </code></pre>
  
  <p>but it is not working.</p>