Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Data source name not found and no default driver specified" for creating access connection

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=;");

And I got this problem:

base {System.Data.Common.DbException} = {"ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"}

I have tried couple of database connection strings from here: http://www.connectionstrings.com/access but none of them working.

Any suggestions for this?

Thanks in advance.

like image 982
olidev Avatar asked Nov 20 '11 12:11

olidev


1 Answers

There is an easy way to get the connection string, try it as follow:

  • 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.

like image 53
Mahmoud Gamal Avatar answered Sep 24 '22 15:09

Mahmoud Gamal