I am trying to make a backup module for my application, here is my code:
try
{
string newDbName = Application.StartupPath + @"\Database1.accdb";
MessageBox.Show("The current directory is: " + newDbName);
File.Copy(backupPicker.FileName, newDbName, true);
MessageBox.Show("Restaurare efectuata cu succes.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
} catch (Exception ex)
{
MessageBox.Show("Nu s-a putut restaura reerva.\nMai multe informatii despre aceasta eroare pot fi gasite in jurnalul de erori.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
But my application doesn't even run! Here the error message that I get from the debugger:
But actually, my application has access allowed to that location. What can I do?