远程sqlserver数据库备份和还原 [英] remote sqlserver database backup and restore

查看:535
本文介绍了远程sqlserver数据库备份和还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够备份和还原本地sqlserver数据库
当我去远程服务器时,我想使用相同的代码
我只想更改连接字符串中的服务器名
我正在使用代码-

i am able to backup and restore local sqlserver database
when i go for remote server then time i want to use my same code
i want change only servername in connection string
i am using code-

<add key ="BACKUP_DATABASE_SERVER" value ="Data Source=admin\SQLEXPRESS;User ID=****;Password=****;"/>



当我使用SERVER类连接时



when i connect using SERVER class

SERVER_NAME=admin\SQLEXPRESS;
 Server srv = new Server(SERVER_NAME);

            //DataTable dtServers = SmoApplication.EnumAvailableSqlServers(true);

            
            ServerConnection srvConn = srv.ConnectionContext;
            srvConn.LoginSecure = true;
            //string strBackupDir = srv.Settings.BackupDirectory;
            DatabaseCollection objDatabases =srv.Databases;


此代码在第一行给出了错误

登录服务器失败


谢谢您


this code gives error on first line

Login failed to server


Thank You

推荐答案

这意味着您的UserID和Password组合对于尝试访问的服务器无效.这样的错误几乎是不言自明的.
您几个小时前问了基本相同的问题.将来,您应该只更新现有问题,而不是在类似问题时创建一个新问题.

干杯.
It means that your UserID and Password combination is not valid for the server you are trying to hit. Errors like this are pretty much self-explanatory.
You asked basically the same question a couple of hours ago. In the future, you should just update the existing question instead of creating a new one when they are this similar.

Cheers.


这篇关于远程sqlserver数据库备份和还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆