如何摆脱错误的:"数据源名称未找到和指定默认驱动程序"在.net中? [英] How to get rid of the error: "Data source name not found and no default driver specified" in .net?

查看:297
本文介绍了如何摆脱错误的:"数据源名称未找到和指定默认驱动程序"在.net中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是想建与在webconfig文件中定义的连接字符串一个asp.net web应用程序。当我尝试调试我得到以下异常:

I was trying to built a asp.net web app with the connection string defined in the webconfig file. When I try to debug I am getting the following exception:

ERROR [IM002] [微软] [ODBC驱动程序管理器]数据源名称找不到和未指定默认驱动程序

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

连接字符串看起来是这样的:

The connection string looks like this:

的connectionString =驱动程序= {MySQL的ODBC 5.1驱动};服务器= XX.XX.XX.XX;端口= 3306;数据库= DB_NAME;用户=用户名; PWD =通;选项= 3;的providerName =System.Data.Odbc/>

connectionString="Driver={MySQL ODBC 5.1 Driver};server=XX.XX.XX.XX;port=3306;database=db_name;user=username;pwd=pass;option=3;" providerName="System.Data.Odbc"/>

安装驱动程序,我可以看到它在ODBC数据源管理器中列出。

The driver is installed and I can see it listed in the 'ODBC Data Source Administrator'.

我试图改变构建配置为任何CPU,还是失败了。

I tried changing the build configuration to 'Any CPU', still it failed.

有人可以帮我图什么怎么回事?

Can somebody help me out to figure whats going on here??

谢谢

乌代

推荐答案

如果您已经安装了ODBC驱动程序,你可以用它编写的可执行文件默认(两个CPU)的x64版本的,否则你必须编译可执行文件的x86仅与使用的x86-32驱动

If you have installed the x64 version of the ODBC driver you can use it compiling the executable as default (both CPU) otherwise you have to compile the executable as x86 only and use the x86-32 driver.

请注意,默认情况下在64位操作系统编译为两个CPU(x64和x86)的应用程序将使用驱动程序的64位版本,这意味着,如果你安装了ODBC驱动程序的32位版本,编译可执行文件无论CPU或x64,你将得到错误,所以你必须编译应用程序仅适用于x86。

Keep in mind that by default on x64 os an application compiled as both CPU (x64 and x86) will use the 64bit version of the driver, this means that if you install the 32bit version of the ODBC driver and compile the executable as Both CPU or x64 you will get the error, so you have to compile the application only x86.

这篇关于如何摆脱错误的:"数据源名称未找到和指定默认驱动程序"在.net中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆