VB6 connection string to SQL Server 2014 for TLS 1.2

I have to support a VB6 app still in production (ugh). A customer is specifying our software needs to be PCI compliant which requires TLS 1.2.

I am using SQL Server 2014 and have all of the (known) patches and updates installed. I am currently at build 12.0.4502.0.

The project is currently referencing "Microsoft ADO Ext. 6.0 for DDL and Security" and "Microsoft ActiveX Data Objects 2.5 Library" libraries.

I have tried different connection strings with no success.

Public Function GetConnection() As ADODB.Connection
  Dim con As ADODB.Connection

  On Error Resume Next
  Set con = New ADODB.Connection
  con.ConnectionTimeout = 10

  Dim connstring As String
  'connstring = "Provider=SQLOLEDB;Server=" & gstrServer & ";Database=" & gstrDB & ";User Id=" & gstrUser & ";Password=" & gstrPwd
  connstring = "Provider=MSDASQL;DRIVER=Sql Server;Server=" & gstrServer & ";Database=" & gstrDB & ";UID=" & gstrUser & ";PWD=" & gstrPwd

  con.Open connstring

  If Err Then Set con = Nothing
  Set GetConnection = con
End Function


1 answer

I found the answer in Using ADO with SQL Server Native Client.

Changing the provider to SQLNCLI11 and adding DataTypeComptibility=80 worked.

Thanks Bob77! You were spot on with using the newer client.