Microsoft KB Archive/817179

= PRB: Visual Studio .NET Stops Responding and You Receive a SQL Server Login Dialog Box When You Run an Application =

Article ID: 817179

Article Last Modified on 10/14/2003

-

APPLIES TO


 * Microsoft Visual Studio .NET 2003 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition

-



SYMPTOMS
Microsoft Visual Studio .NET 2003 stops responding for about 30 seconds when you run an application, and you receive a SQL Server Login dialog box that prompts you for a password. If you type the appropriate password and then click OK, Visual Studio .NET stops responding for about 30 seconds, and then you receive the following SQL Server Login error message:

Connection failed:

SQLState: '08001'

SQL Server Error: 17

[DBNETLIB][ConnectionOpen (Connect).]SQL Server does not exist or access denied.

You can click OK in the SQL Server Login error dialog box and then click Cancel in the SQL Server Login dialog box. If you do this, you receive the following Microsoft Development Environment error message:

Operation was canceled.

If you click OK in response to this message, your application runs.

Note This issue does not occur in Visual Studio .NET 2002.



CAUSE
In Visual Studio .NET, you can set a breakpoint on a stored procedure that is in a Microsoft SQL Server database. When you do this, the breakpoint is associated with your current project. You can subsequently stop SQL Server, and then start your project. When you start this project, the Visual Studio .NET debugger tries to obtain the updated information about the locations of all breakpoints that are associated with the project. To obtain this updated information, the Visual Studio .NET debugger calls Server Explorer. Server Explorer then tries to establish a connection to SQL Server.

When Server Explorer tries to establish a connection to SQL Server, Visual Studio .NET stops responding. This behavior occurs because SQL Server is not currently running. After approximately 30 seconds, you receive the SQL Server Login dialog box that is described in the &quot;Symptoms&quot; section. This 30-second time-out period corresponds to the time-out period for the Server Explorer operation that tries to establish a connection to SQL Server. If you type the appropriate password and then click OK, Visual Studio .NET again stops responding for about 30 seconds. This time-out period also corresponds to the Server Explorer time-out period. You then receive the Microsoft SQL Server Login error message that is described in the &quot;Symptoms&quot; section.



RESOLUTION
To resolve this problem, remove unnecessary database connections from Server Explorer. To do this, follow these steps:
 * 1) Quit your application.
 * 2) In Server Explorer, right-click any unnecessary database connections, and then click Delete.
 * 3) In the Server Explorer dialog box that appears, click Yes.
 * 4) Quit Visual Studio .NET.
 * 5) Start Visual Studio .NET.
 * 6) Start your application.
 * 7) On the Debug menu, click Start to run your application. You do not notice the behavior that is described in the &quot;Symptoms&quot; section, and your application runs as you expect.



STATUS
This behavior is by design.



Steps to Reproduce the Behavior

 * 1) Start Visual Studio .NET.
 * 2) Create a Windows Application project by using Microsoft Visual C# .NET or Microsoft Visual Basic .NET. By default, Form1 is created.
 * 3) On the Tools menu, click Connect to Database. The Data Link Properties dialog box appears.
 * 4) In the Select or enter a server name box, type the name of a server that is running SQL Server.
 * 5) In the User name text box, type your SQL Server user name.
 * 6) In the Password text box, type your SQL Server password.
 * 7) In the Select the database on the server list, click Northwind, and then click OK. The SQL Server Login dialog box appears.
 * 8) In the Password text box, type your SQL Server password, and then click OK. You notice that Server Explorer adds a new database connection under the Data Connections node.
 * 9) In Server Explorer, expand the database connection that you created in step 8.
 * 10) Expand the Stored Procedures node.
 * 11) Right-click CustOrderHist, and then click Edit Stored Procedure.
 * 12) In the Code Editor, click to set a breakpoint on the third line of the CustOrderHist stored procedure.
 * 13) Quit Visual Studio .NET.
 * 14) Stop the instance of SQL Server that you specified in step 4.
 * 15) Start Visual Studio .NET.
 * 16) Open the project that you created in step 2.
 * 17) On the Debug menu, click Start to run your application. You experience the behavior that the &quot;Symptoms&quot; section describes.

