Disposer
Disposer

Reputation: 769

MS Access ODBC problems

I have the following problems with using ODBC driver with MS Access database my connection string for database is

private const string connectionString = @"Driver={Microsoft Access Driver (*.mdb)};Dbq=D:\work\client.mdb;Pwd=sql;";

But when i try to connect to database i get error

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] Could not find file 'D:\work\MyApp\MyApp\bin\Debug\dba.mdb'.

Ok, i've put mdb file to location D:\work\MyApp\MyApp\bin\Debug and rename it to dba.mdb and get another error:

ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] Not a valid password.

Can anybody help me to solve problem.

Thank you in advanced.

Upvotes: 2

Views: 3472

Answers (2)

Disposer
Disposer

Reputation: 769

I've found a problem. It was because query to database included scheme name

SELECT CODE, ISOCODE FROM dba.Table1

It happens because my code must support two kind of databases MS SQL Server and MS Access. For MS SQL Server select works ok, but for Access it born not untestable errors, such i've posted in my question above. When i've remove 'dba' from select it become working without any problem.

Upvotes: 3

MUG4N
MUG4N

Reputation: 19717

You are missing the UID:

Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;

Upvotes: 0

Related Questions