简体   繁体   English

(提供者:命名管道提供程序,错误:40-无法打开与SQL Server的连接)

[英](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.

相关问题 连接到本地网络上的 MariaDB 服务器时出现命名管道提供程序错误 - Named Pipes Provider Error When connecting to MariaDB server on local network 命名管道错误40:Visual Studio 2012 MySQL - Named Pipes Error 40: Visual Studio 2012 MySQL MySQL无法打开与SQL Server的连接 - MySQL Could not open a connection to SQL Server MySQL Windows c API命名管道错误:“在'等待初始通信数据包'时与MySQL服务器的连接丢失,系统错误:0 - MySQL Windows c api named pipes ERROR: "Lost connection to MySQL server at 'Waiting for initial communication packet', system error: 0 无法实例化连接提供程序:NHibernate.Driver.MySqlDataDriver - Could not instantiate connection provider: NHibernate.Driver.MySqlDataDriver DataMapperException:无法打开与“ MySQL,MySQL provider 5.0.8.1”的连接 - DataMapperException: Unable to open connection to “MySQL, MySQL provider 5.0.8.1” SQL Server 2005 32位-错误:链接服务器“(null)”的OLE DB提供程序“ OLEDB.1”报告错误。 提供者内存不足 - SQL Server 2005 32 bit -Error: The OLE DB provider “OLEDB.1” for linked server “(null)” reported an error. The provider ran out of memory MySQL SQL ASP角色提供程序错误。 无法连接到SQL Server数据库 - mySQL asp role provider error. Unable to connect to SQL Server database Hibernate-没有名为*的EntityManager持久性提供程序 - Hibernate - No presistence provider for EntityManager named * “无法创建与数据库服务器的连接” netbeans谷歌云sql错误 - “Could not create connection to database server” netbeans google cloud sql error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM