我试图通过asp.net webservice连接到mysql数据库,但它给了我这个错误
A network-related or instance-specific error occured 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 the SQL server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
我正在使用MySQL数据库,我的连接字符串是
"Data Source=localhost;Initial Catalog=test;User Id=root;Password=;Integrated Security=True"
到目前为止,我见过的几乎所有解决方案都是针对MS SQL的。提前致谢
答案 0 :(得分:0)
有点忙,但今天决定坐下来真正开始工作,这就是我解决它的方法,我为项目添加了对MySQL Data的引用(当然在安装.net连接器之后)然后使用了MySql.Data。 MySqlClient导入而不是System.Data.SqlClient和其他所有内容,例如而不是SqlConnection更改为MySqlConnection和瞧,因为MySQL工作就像一个魅力