Vb6 string connecting ADODB to SQL Server 2008

I recently migrated a database from SQL Server 2005 to 2008 to Windows Server 2008. Clients connect perfectly to their XP computers, as well as SQL Management Studio 2008. I also tested the remote connection using LINQPad, which worked fine.

However, in my VB6 application, the connection string seems to be giving me problems. Any ideas what I'm doing wrong?

    Dim strUserName As String
     Dim strPassword As String
     Dim sProc As String

     sProc = "Class_clsAdoFnx_Initialize"

        Me.DatabaseName = "db_app"




 'Connect to SQL Server

    strUserName = "admin"
    strPassword = "mudslinger"

    Set cSQLConn = New ADODB.Connection
    '**Original connection String
    'cSQLConn.CommandTimeout = 0
    'cSQLConn.ConnectionString = " PROVIDER=SQLOLEDB" & _
    '    ";SERVER=NET-BRAIN" & _
    '    ";UID=" & strUserName & _
    '    ";PWD=" & strPassword & _
    '    ";DATABASE=" & Me.DatabaseName

    '***First attempt, no dice
    'cSQLConn.ConnectionString = "Provider=sqloledb;" & _
    '       "Data Source=NET-BRAIN;" & _
    '       "Initial Catalog=DB_APP;" & _
    '       "User Id=admin;" & _
    '       "Password=mudslinger"
    'cSQLConn.Open

    '***3rd attempt, no dice 
    cSQLConn.Open "Provider=sqloledb;" & _
           "Data Source=NET-BRAIN;" & _
           "Initial Catalog=db_app;" & _
           "User Id=admin;" & _
           "Password=mudslinger", "admin", "mudslinger"

early.

UPDATE: here is the line that I generated using my test.UL file

Provider

Provider = MSDASQL.1; Password = logmein; Persist Security Info = True; User ID = sa; Extended Properties = "DSN = NET-BRAIN; UID = admin; PWD = mudslinger; APP = Microsoft® Windows®, WSID = BPOOR-16D68FBC7D; DATABASE = DB_App; Network = DBMSSOCN"; = DB_App

UL SQL Native provider:

"Provider = SQLNCLI10.1; Integrated Security =" "; Persist Security Info = False; = admin; = DB_APP; = NET-BRAIN; Name=" "; SPN = "" "

- : Ado... Class_clasAdoFnx_initialize 3001 , . --Error: Class_clsAdoFnx_Initialize 3709 OLE DB, .

[oledb] sql "Provider = SQLOLEDB.1; Password = mudslinger; Persist Security Info = True; = admin; = db_app; =

error: -2147217900 'admin'

UPDATE2: , , , .

+3
1

ADO SQL Server, SQL Server, ADO :

Provider = SQLNCLI10
DataTypeCompatibility = 80

Dim con As New ADODB.Connection

con.ConnectionString = "Provider=SQLNCLI10;" _
         & "SERVER=NET-BRAIN;" _
         & "Database=DB_APP;" _ 
         & "DataTypeCompatibility=80;" _
         & "User Id=admin;" _
         & "Password=mudslinger;"

con.Open
+3

Source: https://habr.com/ru/post/1748254/


All Articles