hi
how to create ms access backup and restore in c#
i have no idea to code please tell me example as code
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
thiyagarajPosted Nov 23, 2015, 11:11 AM
sailu badePosted Aug 27, 2015, 6:03 AM
devanand yadavPosted Jul 11, 2014, 9:40 AM
Thanh NguyenPosted Apr 7, 2014, 12:34 PM
How can i fix it?Please give me answers to [email protected]
Thanks!
Biswa RoyPosted May 19, 2012, 8:04 AM
Kirtan PatelPosted Sep 9, 2009, 10:24 AM
Here is What you want
dont forget to mark "Do you like answer" please it will give me some Credits :)
private void btnBackUp_Click(object sender, EventArgs e)
{
string CurrentDatabasePath = Environment.CurrentDirectory + @"\Database3.accdb";
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK)
{
string PathtobackUp = fbd.SelectedPath.ToString();
File.Copy(CurrentDatabasePath,PathtobackUp+@"\BackUp.accdb",true);
MessageBox.Show("Back Up SuccessFull! ");
}
}
private void button2_Click(object sender, EventArgs e)
{
string PathToRestoreDB = Environment.CurrentDirectory + @"\Database3.accdb";
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
string Filetorestore = ofd.FileName;
// Rename Current Database to .Bak
File.Move(PathToRestoreDB, PathToRestoreDB + ".bak");
//Restore the Databse From Backup Folder
File.Copy(Filetorestore, PathToRestoreDB,true);
}
}