Hi,
I have an application that uses a access-database. The database resides in the folder of the application.
And I use this code to access the database:
private void mainForm_Load(object sender, EventArgs e)
{
AppPath = GetAppPath();
DBConStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + AppPath + @"\DBRoot.mdb";
}
public static string GetAppPath()
{
string AppPath = "";
try
{
AppPath = Path.GetFullPath(".");
AppPath = AppPath.Replace(@"\bin\Debug", "");
AppPath = AppPath.Replace(@"\bin\Release", "");
if (AppPath.EndsWith(@"\") == false) { AppPath += @"\"; }
}
catch (Exception) { throw; }
return AppPath;
}
But when i install the application and run it, the data isn't loaded in my application.
But if I run it again but now with the command run as administrator it works.
What can i do about this?
What is the best way to store you files? Because the /bin/debug
folder is gone after the setup.
Who knows the answer and is willing to help me?
Peter
Configure the installer so that there is read/write permission to mdf file.