Hmmm, What is the error that you get when it doesn't work in any of the cases? Or better, what do you do that causes the error to go from "server not found" to "connection refused" (or vise versa)
Does "Test Connection" button work from within the DataLinks API (.UDL file)? If so, does cutting and pasting the connection string (leaving off the "provider=sqloledb" portion) work? Does Server Explorer in Visual Studio work with your named instance? This will provide you with a connection string too. Does it work if you use OleDbConnection (as a test) with the named instance? Is the SQL Server instance set up to accept TCP/IP connections? (if Query Analyzer works it should be, but...) Are you using SqlConnection from within ASP.NET? If so, does the connection work from within a console app? If you set up an MSDE instance on the machine in question (which uses named instance) does it work with that? Bob Beauchemin http://staff.develop.com/bobb -----Original Message----- From: Martin Welch [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 31, 2002 3:46 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] SqlConnection and named SQL Server 2000 instance Thanks for all your suggestions. Unfortunately, none of them worked :o( Yes, HOTH is a bit cold for Yoda :o) I've tried a variety of things in the connection string. I've eliminated spaces and trailing semi-colons. Incidentally, other tools such as query analyser connect successfully. I've set up an alias. I've double checked that TCP/IP is set in the client network utility. One other thing I forgot to mention was that the two W2K SP3 boxes in question are not part of a domain, only a work group. Could this be the culprit? Martin -----Original Message----- From: Beauchemin, Bob [mailto:[EMAIL PROTECTED]] Sent: 18 December 2002 17:08 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] SqlConnection and named SQL Server 2000 instance 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. 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.
