Need help connection with Microsoft.SqlServer.Management.Smo Transfer class

空扰寡人 提交于 2019-12-03 20:39:12
yayaman

Its too late but it could help some body else,

I had the same problem and its due to the first line, the cast to the SqlConnection. It activates the mixed authentication [thats why you got an error as your login is wrong for 'DOMAIN\user']

I've choose to initialize a simple connection using the SqlConnectionStringBuilder:

var connectionString = ((EntityConnection)base.ReferentielContext.Connection).StoreConnection.ConnectionString;
var builder = new SqlConnectionStringBuilder(connectionString);

var srvConn = new ServerConnection
        {
            ServerInstance = builder.DataSource,
            LoginSecure = false,// set to true for Windows Authentication
            Login = builder.UserID,
            Password = builder.Password
        };

var server = new Microsoft.SqlServer.Management.Smo.Server(srvConn);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!