c# - How to create an Access database backup on .Net? -


i'm working on windows forms application has connection access database. need create backup database. also, user has choose destination folder of backup. can give me on this?

thanks

you can use option of copying access db file location backup.

it can done follows:

file.copy(sourcedbname, destdbname, true); 

or

you can add simple routine takes input database, zip , store it, in backup directory, optionally passing password, this:

using ionic.zip; ......  private void backuptozip(string sourcedbname, string destzipfile, string password) {     using (zipfile zipf = new zipfile(destzipfile))     {         if (bkppass.length > 0) zip.password = password;         zipentry ze = zip.updatefile(sourcedbname, string.empty);         ze.comment = "working copy stored in date: " + datetime.today.toshortdatestring();         zipf.comment = "this zip archive has been created ......";         zipf.save();     } } 

can refer following link more snipets:

http://dotnetzip.codeplex.com/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -