C# visualstudio中的数据库添加

C# visualstudio中的数据库添加,c#,C#,我是C#的新手。我正在尝试做一个学生信息项目。我想补充一下 SQL数据库。但是当我运行这个程序时,我遇到了一些与网络相关的问题 抛出: "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

我是C#的新手。我正在尝试做一个学生信息项目。我想补充一下 SQL数据库。但是当我运行这个程序时,我遇到了一些与网络相关的问题

抛出:

"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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)" (System.Data.SqlClient.SqlException) Exception 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)", Exception Type = "System.Data.SqlClient.SqlException", Exception WinRT Data = ""

我收到此消息。

可能是由于任何原因造成的…连接字符串错误等。您如何尝试连接到数据库?听起来好像连接有问题。可能是不正确的连接字符串,或者可能是SQL server出现问题。尝试连接服务器资源管理器。您是在SQL Management Studio还是在Visual Studio中遇到此错误?您可以尝试以下操作:在左侧的“SQL server配置管理器”窗口中选择“SQL server服务”选项,然后在右侧检查服务SQL server(MSSQLSERVER)是否已停止或正在运行。如果此服务已停止,请右键单击此服务,然后启动此服务。此错误在Visual studio中显示。创建数据库时,我检查了它是否已连接。我按下测试连接,它表明连接成功。con=newsqlconnection(“数据源=OrNoK;集成安全性=Yes;数据库=master”);显示错误是因为da.Fill(ds)此行。