G
Guest
Hi all,
I have MSDE 2000 Release A installed in my Windows XP Pro - Microsoft NT 4
LAN System in the following 2 instances:
1) a "default" instance cofigured to use Windows Authentication Mode,
2) a "named" instance cofigured to use Mixed Mode.
I executed the attached VBA code in Access 2003 and I got a Run-Time Error
'-2147467259 (800004005)': [DBNETLIB][ConnectionOpen(Connect())SQL.Server
does not exist or access denied. I am new in MS SQL Server/MSDE 2000 Release
A and I do not know what is wrong in my code or SQL parameters. Please help
and advise
Thanks in advance,
SHC
/////////////////////////////////////
Sub OpenMySQLDB()
Dim cnn1 As Connection
Dim rst1 As Recordset
Dim str1 As String
'Create a Connection object after instantiating it,
'this time to a SQL Server database.
Set cnn1 = New ADODB.Connection
str1 = "Provider=SQLOLEDB;Data Source=localhost;" & _
"Initial Catalog=NorthwindCS;User Id=sa;Password=SSPI;"
cnn1.Open str1
'Create recordset reference, and set its properties.
Set rst1 = New ADODB.Recordset
rst1.CursorType = adOpenKeyset
rst1.LockType = adLockOptimistic
'Open recordset, and print a test record.
rst1.Open "Customers", cnn1
Debug.Print rst1.Fields(0).Value, rst1.Fields(1).Value
'Clean up objects.
rst1.Close
cnn1.Close
Set rst1 = Nothing
Set cnn1 = Nothing
End Sub
I have MSDE 2000 Release A installed in my Windows XP Pro - Microsoft NT 4
LAN System in the following 2 instances:
1) a "default" instance cofigured to use Windows Authentication Mode,
2) a "named" instance cofigured to use Mixed Mode.
I executed the attached VBA code in Access 2003 and I got a Run-Time Error
'-2147467259 (800004005)': [DBNETLIB][ConnectionOpen(Connect())SQL.Server
does not exist or access denied. I am new in MS SQL Server/MSDE 2000 Release
A and I do not know what is wrong in my code or SQL parameters. Please help
and advise
Thanks in advance,
SHC
/////////////////////////////////////
Sub OpenMySQLDB()
Dim cnn1 As Connection
Dim rst1 As Recordset
Dim str1 As String
'Create a Connection object after instantiating it,
'this time to a SQL Server database.
Set cnn1 = New ADODB.Connection
str1 = "Provider=SQLOLEDB;Data Source=localhost;" & _
"Initial Catalog=NorthwindCS;User Id=sa;Password=SSPI;"
cnn1.Open str1
'Create recordset reference, and set its properties.
Set rst1 = New ADODB.Recordset
rst1.CursorType = adOpenKeyset
rst1.LockType = adLockOptimistic
'Open recordset, and print a test record.
rst1.Open "Customers", cnn1
Debug.Print rst1.Fields(0).Value, rst1.Fields(1).Value
'Clean up objects.
rst1.Close
cnn1.Close
Set rst1 = Nothing
Set cnn1 = Nothing
End Sub