简体   繁体   English

以编程方式还原数据库(SQL Server)

[英]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. 最近,我发现此链接显示了备份和还原sql server数据库的一个很好的例子。 However, my SQL Server only uses WindowsAuthentication and so it does not really require a UserName and Password. 但是,我的SQL Server仅使用WindowsAuthentication,因此它实际上并不需要用户名和密码。 To be able to do this, I turned the line srvConn.LoginSecure = false; 为了做到这一点,我将srvConn.LoginSecure = false;作为行srvConn.LoginSecure = false; into srvConn.LoginSecure = true; 进入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 . 首先,如果要启用到服务器的远程连接(我不确定这是否是您需要的),请尝试以下方法: http : //support.microsoft.com/kb/914277 You will also want to make sure the mixed authentication option is enabled. 您还需要确保启用了混合身份验证选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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