title: How to check a SQL database table to see if a record exists
body: <p>I have a SQL database that creates a record for every document uploaded by the user to the server.  I want to check this table before a user uploads a document to ensure they don't upload a file with name that already exists.</p>
  
  <p>I know how to make the connection and make the SqlCommand to query the table for an existing record.  But I don't know how to check the record count from the sqlCommand I made.  </p>
  
  <p>Does that make sense?</p>
  
  <pre><code>Using myConnectionCheck As New SqlConnection(myConnectionStringCheck)
                  Dim myCommandCheck As New SqlCommand()
                  myCommandCheck.Connection = myConnectionCheck
                  myCommandCheck.CommandText = "SELECT * FROM Req_Docs WHERE Doc_Name =" &amp; DocName
                  myConnectionCheck.Open()
                  myCommandCheck.ExecuteNonQuery()
  
              End Using
  </code></pre>
  
  <p>Thanks in advance,</p>
  
  <p>Anthony</p>