Restore Database using SMO

Restore Database Using SMO

Page 1 of 1

2 Replies - 5074 Views - Last Post: 08 April 2009 - 08:34 AM Rate Topic: -----

#1 ashok_vns05  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-October 08

Restore Database using SMO

Post icon  Posted 08 April 2009 - 01:53 AM

Server sERvERr = new Server();
Restore rEStoRE = new Restore();
rEStoRE .Database = "SMO";
rEStoRE .Action = RestoreActionType.Database;
rEStoRE .Devices.AddDevice(@"C:\SMOTest.bak", DeviceType.File);
rEStoRE .PercentCompleteNotification = 10;
rEStoRE .ReplaceDatabase = true;

rEStoRE .SqlRestore(sERvERr );
Is This A Good Question/Topic? 0
  • +

Replies To: Restore Database using SMO

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6092
  • View blog
  • Posts: 23,612
  • Joined: 23-August 08

Re: Restore Database using SMO

Posted 08 April 2009 - 04:32 AM

What is your question?
Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Restore Database using SMO

Posted 08 April 2009 - 08:34 AM

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:

  • Post the code you're having problems with (DONE)
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1