We help IT Professionals succeed at work.

Can't connect Visual Basic 6.0 to SQL Server 2005.

3,384 Views
Last Modified: 2013-12-25
receiving this error with the following code. "named pipes provider unable to open a connection with sql server [53]

.ConnectionString = "Provider=SQLNCLI;" & _
                                "Server=servername" & _
                                "Database=databasename;" & _
                                "Uid=userid;" & _
                                "Pwd=password;"

Named pipes is enabled on server so I don't know what else to check. I'm using Active X ADO version 2.6 with Visual Basic 6.0
Comment
Watch Question

Commented:
Is the SQL Server configuration set to receive remote connections?

Programs > Microsoft SQL Server 2005 > Configuration > Surface Area Configurations
Top Expert 2007

Commented:
Is the servername the correct one ? If the SQL Server is not the default instance, you should include the name of the instance. For example: MyMachine\SQLEXPRESS ...

Hope this helps ...

Author

Commented:
Yes, server is set to receive remote connections using both TCP/IP and Names Pipes. The server name I am using in my connection string is correct. It is not Express.
Top Expert 2007

Commented:
And you are able to connect to the SQL Server from that machine using sqlcmd ? ... or any other tool ?

Author

Commented:
Yes, I get a response. ie:
sqlcmd -S myServer\instanceName
I get a 1>

I also connect using my SQL Server Client Tools. ie: Management Studio

Author

Commented:
The database "servername" according to connection properties of sqlserver has a backslash in it. The instance name does not. Not sure if this is relevant to my problem though. It would make things easier to deal with if the server name had a one word name with no backslash I suppose. If sql server shows it as a backslash then why must I use a forward slash when expressing it in my connection string?
Top Expert 2007
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Using a backslash results in error:
SQL Network Interfaces Error Locating Server/Instance specified. [xFFFFFF]

Author

Commented:
I noticed the semicolon was missing. oooops. Well we covered the other things to check anyways.
Top Expert 2007

Commented:
:-)

Author

Commented:
But you did help me notice this though because you got me back into thinking that I WAS supposed to be using the backslash.
    "Server=servername\instancename" & _

How can we get te instancename for above statement?
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.