sql server - How to restore local database in ASP.Net web application using entity framework? -
i want add option in web application restore database. storedprocedure
:
alter procedure [restore] @path nvarchar(max) begin exec('alter database kimiakesht set offline') exec('alter database kimiakesht set single_user rollback immediate') restore database kimiakesht disk = @path replace exec('alter database kimiakesht set multi_user') exec('alter database kimiakesht set online') end
and call procedure in application seen below:
string backuppath = "f:\restore\file.bak"; entity.database.executesqlcommand(system.data.entity.transactionalbehavior.donotensuretransaction, "exec [restore] @path = n'" + backuppath + "'");
but error:
Comments
Post a Comment