简体   繁体   English

我的SQL连接错误Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序

[英]My Sql Connection error Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I am trying to connect to MySql database with c#. 我正在尝试使用c#连接到MySql数据库。 But i am getting this error. 但是我得到这个错误。

   Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

My c# code 我的C#代码

 Connection con = new Connection();
        Recordset rs = new Recordset();
        string conStr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
        con.Open(conStr);  // Here its throwing the error

Connection string: 连接字符串:

<add name="DefaultConnection" 
         connectionString="DRIVER={MySQL ODBC 5.2w Driver};Server=localhost;Database=laundrydatabase;Uid=root;Pwd=123"
         />

I am using 我在用

mysql-connector-net-6.6.5
MySQL ODBC 5.1 Driver}

在此处输入图片说明

在此处输入图片说明

You have the MySQL ODBC driver 5.1 installed but your connection string says version 5.2. 您已经安装了MySQL ODBC驱动程序5.1,但是您的连接字符串为5.2版。 This means the system cannot find the driver and that is indicated by the second half of the error message. 这意味着系统找不到驱动程序,并且错误消息的后半部分指出了这一点。 the easiest way to fix is to remove the driver reference from connection string: 修复最简单的方法是从连接字符串中删除驱动程序引用:

Server=localhost;Database=laundrydatabase;Uid=root;Pwd=123

Or if you need to specify the driver, fix the reference like this: 或者,如果您需要指定驱动程序,请像这样修复引用:

Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=laundrydatabase;Uid=root;Pwd=123

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从C#通过ODBC访问Sql Server:错误[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序 - Access to Sql Server via ODBC from C# : ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 附加信息:错误[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序 - Additional information: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ODBC错误-找不到数据源名称,并且未指定默认驱动程序 - ODBC Error - Data source name not found and no default driver specified ADODB连接-错误:找不到数据源名称,并且未指定默认驱动程序 - ADODB Connection - Error: Data source name not found and no default driver specified Postgresql odbc驱动程序错误c#[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称 - Postgresql odbc driver error c# [IM002] [Microsoft][ODBC Driver Manager] Data source name not found 错误找不到数据源名称,并且在ADO.NET中没有使用Odbc指定默认驱动程序 - Error Data source name not found and no default driver specified with Odbc in ADO.NET “未找到数据源名称且未指定默认驱动程序”用于创建访问连接 - “Data source name not found and no default driver specified” for creating access connection 未找到数据源名称且未指定默认驱动程序 - Data source name not found and no default driver specified 未找到数据源名称且未指定默认驱动程序 - Data source name not found and no default driver specified “未找到数据源名称且未指定默认驱动程序”错误 - “Data source name not found and no default driver specified” error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM