简体   繁体   中英

Restore a Database Programatically (SQL Server)

I recently found this link which shows a great example of backing up and restoring a sql server database. However, my SQL Server only uses WindowsAuthentication and so it does not really require a UserName and Password. To be able to do this, I turned the line srvConn.LoginSecure = false; into srvConn.LoginSecure = true;

I was expecting to connect succesfully to the Server. However, this example returns an exception saying that it was unable to connect to the server.

Can anybody help me please? I have to learn this application for me to be able to apply the same concept to a project i'm working on. Thank you very much.

First of all if you want to enable remote connection to your server (I'm not sure if this is what you're after), Try this: http://support.microsoft.com/kb/914277 . You will also want to make sure the mixed authentication option is enabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM