"数据源名称未找到和指定默认驱动程序"创建访问连接 [英] "Data source name not found and no default driver specified" for creating access connection
本文介绍了"数据源名称未找到和指定默认驱动程序"创建访问连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的连接在.NET中访问数据库:
This is my connection to an access database in .NET:
OdbcConnection conn = new OdbcConnection("Driver={Microsoft Access Driver (*.mdb)};Dbq=" + path + "\\Access.mdb;Uid=;Pwd=;");
和我得到了这个问题:
base {System.Data.Common.DbException} = {"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"}
从这里
我已经试过几个数据库连接字符串: http://www.connectionstrings.com/access一>,但他们都不工作。
I have tried couple of database connection strings from here: http://www.connectionstrings.com/access but none of them working.
这有什么建议?
在此先感谢。
推荐答案
有一个简单的方法来连接字符串,尝试如下:
There is an easy way to get the connection string, try it as follow:
- 创建一个文本文件,并改变它的扩展
.UDL
。 - 打开双新的文件,单击它并选择用任何文本编辑器,记事本,例如将其打开。
- 在打开的窗口中,选择您的供应商,你的数据库,然后单击确定。
- 用记事本打开该文件作为文本,你会发现里面的connectoin字符串。
- Create a text file and change it's extension to
.udl
. - Open the new file by double click it and choose to open it with any text editor, notepad for example.
- In the opened window, choose your provider and your database and click OK.
- Open this file with notepad as a text and you will find the connectoin string inside it.
请参阅 这 更多的细节。
See This for more details.
这篇关于"数据源名称未找到和指定默认驱动程序"创建访问连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文