I am creating a C# windows form applications, the working can be summarized as users fills some form and data is saved in Access database. Now the problem I am facing is tha
I have met this problem before. I solve it in such a way.
(1)in your app.config file, put a placeholder in the connection string. the connection string will contains the file path of the access db file. replace the path with a special string.
(2)when your application start, use Directory.GetCurrentDirectory to get app path.
before create a connection, replace the ##path## with the actual path on client computer.
static void test()
{
string s = ConfigurationManager.ConnectionStrings["test"].ConnectionString;
s.Replace("##path##", Directory.GetCurrentDirectory());
OleDbConnection conn = new OleDbConnection(s);
}