You can use AppDomain.CurrentDomain.BaseDirectory
to get the application directory.
conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source =" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database.accdb"));
Edit : When developing a Windows/Console app, AppDomain.CurrentDomain.BaseDirectory
may point to the "\bin\debug" directory instead of the root. In that case, you could use ..\..\
to move two levels up and obtain your program's root directory.
conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source =" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\Database.accdb"));
If you'd like to write code that works with both Web and Windows applications, you could take a look at this answer.