Skip to content

Instantly share code, notes, and snippets.

@jaysonrowe
Created September 18, 2012 01:22
Show Gist options
  • Save jaysonrowe/3740735 to your computer and use it in GitHub Desktop.
Save jaysonrowe/3740735 to your computer and use it in GitHub Desktop.
restore database
res.RelocateFiles.Add(new RelocateFile(mdfname, dbpath + dbname + ".mdf"));
res.RelocateFiles.Add(new RelocateFile(ldfname, dbpath + dbname + "_log" + ".ldf"));
try
{
res.SqlRestore(svr);
}
catch (FailedOperationException fox)
{
str.WriteLine("{0} Exception caught.", fox.Message);
}
catch (Exception x)
{
str.WriteLine("{0} Exception caught.", x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment