Debugging an application and thankfully I have managed to add good exception handling.
Here is the error message :-
Attempt to connect to Provider = Microsoft.ACE.Oledb.12.0;User ID = Admin;Data Source=\\hrdb\payroll\payroll.mdb failed.
Exception Type is System.Data.OleDb.OleDbException
Exception Message is The Microsoft Access database engine cannot open or write to the file '\\hrdb\payroll\payroll.mdb'. It is already opened exclusively by another user, or you need permission to view and write its data.
Error Code is -2147467259
Error Source is Microsoft Access Database Engine
Error Inner Exception is
Stack Trace is at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at intc.svc.timer1_Elapsed(Object sender, ElapsedEventArgs e) in C:\\Service1.cs:line 339
I watched the connection string over and over. Installed the Database Connectivity driver and no good.
Finally, I accepted the error message.
Error Message :-
The Microsoft Access database engine cannot open or write to the file ‘\\hrdb\payroll\payroll.mdb’. It is already opened exclusively by another user, or you need permission to view and write its data.
Error Code is -2147467259.
The keyword is need permission to view and write.
The contextual user did not have the permission needed.