-2

I am doing a project in Visual C# connecting a database. Everything was going fine for weeks. But yesterday I just created some tables and dropped them and today the server is not getting connected. I am sick with fear because my due date is very near please help me. I tried enabling tcp/ip but doesn't work. here is the error message.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (.Net SqlClient Data Provider)

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
vidya
  • 77
  • 6
  • Error looks more like it can not find the SQL server itself. Are you connecting over the net to this database? make sure it's still at the same location and port. if its local check the port number for the connection. Also go into details, i.e. can you connect to it via an external shell program like tera term or MSQL Server management studio? saying "it doesn't work" isn't going to get good responses. – Byren Higgin Apr 18 '16 at 03:26
  • Go to Services and check if Sql Server service is running – alejandro zuleta Apr 18 '16 at 03:30

4 Answers4

1

Try these trouble shoots:-

  1. Try to connect the same database through SQL Server management studio. If this works fine, then your connection string might be wrong.
  2. If Management studio also fail to connect, check the Server is running. For that go to Services ("Administrative tools"->Servoces) and check the specified SQL server is in running status. If your service is running and you are not able to access the DB though management studio then there must be some serious issue!!
  3. If the service is not able to start, then check your windows credentials are changed? if yes take the service property and open the "Log on" tab and provide the correct credentials.
Shinoy Babu
  • 1,641
  • 2
  • 12
  • 12
0

Please try following

1) Ping Your server 2) Check the Sql Services on the server. 3) I dont think there is any issue related to connection string , but still check it once. 4) Nothing works please restart the Machine.

NishantMittal
  • 537
  • 1
  • 4
  • 17
0

The same will be rectified while restarting the sqlserver management studio.

JENKINS J
  • 153
  • 11
0

I think that this could be one possibility. Just make sure that sql server service/Agent Services are turned-on(started) on your system. This is the main problem in windows 10. SQL Service is sometimes does not start automatically even it is set to "Automatic Start" mode in service properties. Start it manually and Make it to delay start form properties for next time system starts.

error_handler
  • 1,191
  • 11
  • 19