Unable to connect to SQL Server 2005
Posted on 2006-07-20
I was able to connect to a SQL Server 2003 database. We migrated to SQL Server 2005 and now the exact same connection string no longer works.
Can someone help?
I am referencing the Microsoft OLE DB ActiveX Data Objects 1.0 Library in my VB6 project.
Public Function EstablishConnection(ByVal sServerPath As String, ByVal sDb As String, _
ByVal sUser As String, ByVal sPwd As String) As Boolean
1 On Error GoTo ErrHandler
2 Dim strConnectString As String
4 Set g_cnn = New ADODB.Connection
5 strConnectString = "Provider=sqloledb;" & _
"Server=" & sServerPath & ";" & _
"Database=" & sDb & ";" & _
"User Id=" & sUser & ";" & _
"Password=" & sPwd
6 g_cnn.Open strConnectString
Our .NET developers ran into the same situation and had to install the SQL Native Client. Now they can connect in .NET.
Ive installed the SQL Native Client but still no luck. If I change the string to "Provider=SQLNCLI;" what do I reference in my project???
How can I connect to SQL Server 2005 in my vb6 project??