0

I get this error at runtime:

Additional information: 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)

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    Why would you connect to SSMS in C#? Wouldn't you just connect directly to a database? Seems like your question really has nothing to do with SSMS. – mason Sep 22 '17 at 17:58
  • Google the error message, or search here for it. This question has been asked (and answered) many times before here. Posting it yet again is meaningless, as is a capture of your entire screen to describe a textual error message. – Ken White Sep 22 '17 at 18:02
  • So, what do you propose exactly? – Nechir Ibrahim Sep 22 '17 at 18:03
  • I would argue the duplicate nature of this question. Albeit Similar not Duplicate. It is a different question altogether and will most likely not result in a compliant answer due to the Context of the OP question. – GoldBishop Sep 23 '17 at 02:10

1 Answers1

0
  1. You need to try and use SSMS to connect to the Database LibraryDB.
  2. Your Connection String Data Source is malformed and not syntactically correct. LocalDB will NEVER have a HashTag after the name.
  3. You better have a Database Server running on your machine, using . (LocalHost), otherwise you will need to change the Driver to be something other than SqlServer.

Read-Up: https://blogs.msdn.microsoft.com/sql_protocols/2008/09/19/understanding-data-sourcelocal-in-sql-server-connection-strings/

GoldBishop
  • 2,820
  • 4
  • 47
  • 82