Code that Worked with SQL 2000 Does Not with SQL 2005

C

Chaplain Doug

Excel 2003. SQl Server 2005. I have the following code that worked fine
with SQL Server 2000. Now that I have installed SQL 2005, it no longer
works. What do I need to change?

Dim cn As ADODB.Connection
Dim sql As String
On Error GoTo Err_PT
Set cn = New ADODB.Connection
cn.Open "Provider=sqloledb;" & _
"Data Source=HQServer;" & _
"Initial Catalog=Good_News_FE;" & _
"User ID=FEOpen7;" & _
"Password=fe"

Incidentally, The SQL 2005 Server is names HQSERVER, the database is named
Good_News_FE. The user name FEOpen 7 exists and it has a password of fe.
Moreover, user FEOpen7 has been defined to have access to the database.

When the above code executes, it returns the follwing error:

Error Number: -2147467259
Error Text: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist
or access denied.


THANKS for any help that could be provided. God bless.
 
C

Chaplain Doug

My own error. The new SQL instance is called HQServer\HQServer. When I
changed that, the code worked. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top