1

In Windows Forms after right click on my project and choose add event, in data, by clicking on data-based .. C# interrupted and shows this error:

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: 50 - Local Database Runtime error occurred, Error occurred during LocalD8 instance startup: SQL Server process failed to start,

How can I fix it?

jps
  • 20,041
  • 15
  • 75
  • 79
Hm tk
  • 23
  • 4
  • 1
    What database are you using? Have you checked if it is running? Is a firewall blocking the connection? Please provide more information. – Daniel W. Apr 28 '23 at 05:44
  • And, did you verify those suggestions? – Hans Kesting Apr 28 '23 at 06:27
  • I am learning c# and in that the teacher created a database, in add/new item/data/service-based database, I have checked my firewall and did not see SQL name in the panel. – Hm tk Apr 28 '23 at 07:40

1 Answers1

0

When you install VS, the LocalDB version of SQL Server can be installed too. In your case, either it was not installed or, by the sound of it, may not have installed properly. You should restart your computer and try again and, if that doesn't fix the issue, you should repair VS. If that still doesn't fix the issue, you should at least uninstall LocalDB but possibly VS entirely, then restart and reinstall.

jmcilhinney
  • 50,448
  • 5
  • 26
  • 46