Connection to MS SQL Server database closes when application starts c#
Every time i attempt to debug my c# application i start the connection by right clicking on the server explorer but as soon as the application starts the connection closes again (get the red disconnection symbol) and i cannot seem to keep it open. Not sure why this is happening and im sure its nothing to do with the code that has been written as this has only recently started happening.
I think this is also causing another problem i am having where data is not being inserted into the database when an insert command is run.
Try to follow those steps:
- Start SQL Server Configuration Manager
- Open the SQL Server Network Configuration's node.
- Click on the Protocols for MSSQLServer as listed above.
- Then in the right hand pane enable TCP/IP.
- Now double click TCP/IP to get a dialog window.
- If you want to listen on all the IP addresses for the server Select Yes in the Listen All box on the first Protocol tab; otherwise
- Select the IP Addresses tab and enable the desired IP addresses by setting Enabled to Yes.
Forgot I hadn't answered this. As Joel suggested, what i was seeing in the Server Explorer where the connection seemed to fail was just the Server Explorer behaving as it should and not the actual problem. The problem with data not being inserted was just a problem with my insert statement. CHECK YOUR STATEMENTS.