Friends... Since,
OleDbConnection vcon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=C:\Users\Tushar\Documents\db.accdb");
This string use in c# for ms access database connection..see database location already known and it works..
But, I want to run application when database in any location ...(i.e) it should take database location Automatically from any location( when user save project in any location)
Can some buddy help me..
Thanks in Advance..
I suggest creating the logic in C# to determine where the DB is. Once you know, it's as simple as string concatenation:
var dbLocation = GetDbLocation();
OleDbConnection vcon = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=" + dbLocation ");
GetDbLocation() could pull the information from a config file, or determine it in some other way (you haven't given us enough information to determine where the DB is located).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With