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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Sep 9, 2009, 6:24 AM EDT
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);
}
}
Biswa Roy2 reputationPosted May 19, 2012, 4:04 AM EDT
Thanh Nguyen2 reputationPosted Apr 7, 2014, 8:34 AM EDT
How can i fix it?Please give me answers to [email protected]
Thanks!
devanand yadav2 reputationPosted Jul 11, 2014, 5:40 AM EDT
sailu bade45 reputationPosted Aug 27, 2015, 2:03 AM EDT
thiyagaraj8 reputationPosted Nov 23, 2015, 6:11 AM EST