title: VB6 Connecting to a Database
body: <p>Alright, what i want to do sounds simple. I would like to load a form and on form load call a sql statement that returns 1 item and places it in TextBox1. Here is what i have so far.</p>
  
  <pre><code> Private Sub Form_Load()
  
   Call openTheDatabase
  
   End Sub
  
   Public Function openTheDatabase() As Boolean
  
   '-- Here we want to open the database
   Dim sConnectionString As String
   Dim strSQLStmt As String
  
   '-- Build the connection string
   sConnectionString = "PROVIDER = MSDASQL;driver={SQL Server};database=databasename ;server=servername;uid=;pwd=;"
  
  
   strSQLStmt = "SELECT chvDealerName " &amp; _
          "From dbo.tblDealers Where chrVSCAcctNum = '90442001'"
  
   TextBox1.Text = strSQLStmt
  
   End Function
  </code></pre>
  
  <p>EDIT</p>
  
  <p>Ok it was Text1.Text, but now im just getting the string in the textbox, not the actual database entry</p>