title: vb6-connecting to a remote server with mysql
body: <p>I have a VB6 project where would be adding data to database and querying it later. I have a method <code>updateDB</code> for updating the database with fields:</p>
  
  <pre><code>Function UpdateDB()
  Dim DBCon As ADODB.Connection
  Dim DBCmd As ADODB.Command
  Dim dbrecset As ADODB.Recordset
  
  
  Set DBCon = New ADODB.Connection
  DBCon.CursorLocation = adUseClient
  DBCon.ConnectionString = "Driver = {MySQL ODBC 3.51 Driver}; Server =myHosting; Port = 3306;Database=myDB;UID=myUID;PWD=12345;Option=16427;"
  
  DBCon.Open
  Set dbrecset = New ADODB.Recordset
  With DBCmd
  .ActiveConnection = DBCon
  .CommandText = "UPDATE vbtest SET Name = '" &amp; Text1.Text &amp; "'," _
  &amp; "Serial = '" &amp; Text2.Text &amp; "'," _
  &amp; "WHERE Key = '" &amp; Text3.Text &amp; "' AND Name IS NULL"
  .CommandType = adCmdText
  End With
  
  With dbrecset
  .CursorType = adOpenStatic
  .CursorLocation = adUseClient
  .LockType = adLockOptimistic
  .Open DBCmd
  End With
  
  dbrecset.Close
  DBCon.Close
  
  End Function
  </code></pre>
  
  <p>This function gives the following error at run-time.</p>
  
  <p><img src="https://i.stack.imgur.com/E0L3E.png" alt="VBError"></p>
  
  <p><strong>EDIT</strong>:I have tried it by using versions 3.51/5.1/5.2 of the ODBC drivers</p>
  
  <p>What am I doing wrong? Been stuck around for days now. Please help</p>