title: Match file in database
body: <p>I have a problem where I can't get a 'msg box' that tells me files that I have browsed match with files in the database. I use an SQL Server database and I have already inserted data that matches with the files that I am browsing. This is my code:</p>
  
  <pre><code>Private Sub CmdUp_Click()
  
  db
  
  End Sub
  
  Public Sub db()
  
  Dim DBCon As ADODB.Connection
  Dim Cmd As ADODB.Command
  Dim Rs As ADODB.Recordset
  Dim strName As String
   Dim file As String
  
  file = Text1.Text
  
  Set DBCon = New ADODB.Connection
      DBCon.CursorLocation = adUseClient
  
  DBCon.Open "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Port=3306;Database=mforce; User=root;Password=;Option=3;"
  
  Set Cmd = New ADODB.Command
  Cmd.ActiveConnection = DBCon
  Cmd.CommandType = adCmdText
  Cmd.CommandText = "SELECT Sample FROM static WHERE ID = 1"
  
  Set Rs = Cmd.Execute
  
  Do While Not Rs.EOF
  
      Rs.MoveNext
  
  Loop
  
   If Form1.Text1.Text = strName Then
     MsgBox " sample match"
  
  End If
  DBCon.Close
  
  'Delete all references
  Set Rs = Nothing
  Set Cmd = Nothing
  Set DBCon = Nothing
  
  End Sub
  </code></pre>