Named instances work OK here. 

A way around using named instances at all (something to try if you are having trouble 
with them or using an old API that can't deal with them) is to add an alias in SQL 
Server Client configuration utility. Alias a TCP/IP connection to data 
source=hoth\\projectx to myserver or some other name. Also, use client config utility 
to make sure your client is using TCP/IP (it should be by default), you can get 
"connection refused" if you don't have permission to open a named pipe connection on 
the SQL Server machine. "Connection refused" is a totally different error than "server 
not found".

You can also create a file that has a .UDL suffix and use it to tweak your connection 
parameters until "Test Connection" works. Then open the .UDL in Notepad and extract 
the connection string.

Someone else already suggested losing the trailing comma.

Bob Beauchemin
http://staff.develop.com/bobb

-----Original Message-----
From: Martin Welch [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 1:18 AM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] SqlConnection and named SQL Server 2000
instance


Has anyone successfully connected to a named database instance with
SQLConnection?

I assumed something like this would work but all I get is server not found
or refused connection errors:

SqlConnection conn = new SqlConnection("user id=jedi;password=yoda;initial
catalog=pubs; data source=hoth\\projectx;");
conn.Open();

I've trawled though google, on line help and msdn but so far I've come up
with nothing.

Can anyone enlighten me?

Martin

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to