c# 4.0 - not ab;e to restore database from .bak file -
i habe taken backup of sql server ce database not able resotore it.
try { string filename = "tapedatabase.sdf"; string sourcepath = backuppath; openfiledialog ofd = new openfiledialog(); ofd.showdialog(); string fn = ofd.filename; string restorepath = path.getdirectoryname(system.windows.forms.application.startuppath); string sourcefile = system.io.path.combine(fn); string destfile = system.io.path.combine(restorepath, filename); try { system.io.file.copy(sourcefile, destfile, true); messagebox.show("database restored to: " + destfile, "info"); } catch(exception epp) { messagebox.show("database not restored"); }
Comments
Post a Comment