[英](provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Additional information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. 附加信息:建立与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.
验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) .
(提供者:命名管道提供者,错误:40-无法打开与SQL Server的连接)。
I'm trying to connect to my online database from my vb website project but always getting the error above 我正在尝试从我的vb网站项目连接到我的在线数据库,但总是收到上面的错误
i tried to change the server name to an ip,localhost but still the same problem ! 我试图将服务器名称更改为ip,localhost,但是仍然是同样的问题!
my connecting string 我的连接字符串
cnn.ConnectionString = "server=mrsandg.com; user=username ;password=password ;Database=my_db;" cnn.ConnectionString =“ server = mrsandg.com;用户=用户名;密码=密码;数据库= my_db;”
i checked 我检查了
Connecting to a Online MySQL Database using VB.Net 使用VB.Net连接到在线MySQL数据库
SqlConnection error Named Pipes Provider SqlConnection错误命名管道提供程序
https://www.daniweb.com/programming/software-development/threads/488146/how-to-connect-vb-net-on-a-online-database https://www.daniweb.com/programming/software-development/threads/488146/how-to-connect-vb-net-on-a-online-database
Your problem is that you are using a System.Data.SqlClient.SqlConnection
in an attempt to connect to a MySql
server. 您的问题是您正在使用
System.Data.SqlClient.SqlConnection
尝试连接到MySql
服务器。
To connect to MySql
you need to use a MySqlConnection
which will require you adding a reference MySql provider for Ado.Net called MySql.Data
要连接到
MySql
您需要使用MySqlConnection
,这将需要您为Ado.Net添加一个名为MySql.Data
的引用MySql提供程序。
The easiest way to do this is by using NuGet Package Manager. 最简单的方法是使用NuGet软件包管理器。 In Visual Studio Click: Tools > NuGet Package Manger -> Manage Nuget Packages For Solution.
在Visual Studio中,单击:工具> NuGet软件包管理器->管理解决方案的Nuget软件包。
In the form, click on Browse and select MySql.Data. 在表单中,单击“浏览”,然后选择“ MySql.Data”。
Note: there is also an EntityFramework provider if you wish to use that instead of Ado.Net. 注意:如果您想使用它而不是Ado.Net,则还有一个EntityFramework提供程序。
From Here, check the projects you want to use the provider in and click install. 从此处,检查要在其中使用提供程序的项目,然后单击安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.