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:
Comments
Post a Comment