• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3365
  • Last Modified:

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

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
0
claghorn
Asked:
claghorn
1 Solution
 
ptjcbCommented:
Is the SQL Server configuration set to receive remote connections?

Programs > Microsoft SQL Server 2005 > Configuration > Surface Area Configurations
0
 
YveauCommented:
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 ...
0
 
claghornAuthor 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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
YveauCommented:
And you are able to connect to the SQL Server from that machine using sqlcmd ? ... or any other tool ?
0
 
claghornAuthor 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
0
 
claghornAuthor 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?
0
 
YveauCommented:
OK, so you should try:
.ConnectionString = "Provider=SQLNCLI;" & _
                                "Server=servername\instancename" & _
                                "Database=databasename;" & _
                                "Uid=userid;" & _
                                "Pwd=password;"

hope this helps ...
0
 
claghornAuthor Commented:
Using a backslash results in error:
SQL Network Interfaces Error Locating Server/Instance specified. [xFFFFFF]
0
 
claghornAuthor Commented:
I noticed the semicolon was missing. oooops. Well we covered the other things to check anyways.
0
 
YveauCommented:
:-)
0
 
claghornAuthor 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.
0
 
AbhishekSharmaCommented:
    "Server=servername\instancename" & _

How can we get te instancename for above statement?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now