Link to home
Start Free TrialLog in
Avatar of claghorn
claghorn

asked on

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
Avatar of ptjcb
ptjcb
Flag of United States of America image

Is the SQL Server configuration set to receive remote connections?

Programs > Microsoft SQL Server 2005 > Configuration > Surface Area Configurations
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 ...
Avatar of claghorn
claghorn

ASKER

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.
And you are able to connect to the SQL Server from that machine using sqlcmd ? ... or any other tool ?
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
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?
ASKER CERTIFIED SOLUTION
Avatar of Yveau
Yveau
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Using a backslash results in error:
SQL Network Interfaces Error Locating Server/Instance specified. [xFFFFFF]
I noticed the semicolon was missing. oooops. Well we covered the other things to check anyways.
:-)
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?