本文介绍了SQL Server管理对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了同样的错误下面使用任何可信或SQL登录的code:
在transfer.TransferData炸弹
这感觉安全。任何想法将真棒!
使用系统;
使用System.Collections.Generic;
使用System.Linq的;
使用System.Text;
使用Microsoft.SqlServer.Management.Smo;
使用Microsoft.SqlServer.Management.Common;
使用System.Collections.Specialized;
使用System.IO;
使用System.Configuration;
命名空间GenerateScripts
{
类节目
{
静态无效的主要(字串[] args)
{
ServerConnection sourceConnection =新ServerConnection(localhost的);
服务器sourceServer =新服务器(sourceConnection);
//sourceServer.ConnectionContext.LoginSecure = FALSE;
//sourceServer.ConnectionContext.Login =3TIER;
//sourceServer.ConnectionContext.Password =3TIER;
数据库sourceDatabase = sourceServer.Databases [3TIER];
// 目的地
ServerConnection destinationConnection =新ServerConnection(localhost的);
服务器destinationServer =新服务器(destinationConnection);
//destinationServer.ConnectionContext.LoginSecure = FALSE;
//destinationServer.ConnectionContext.Login =3tier2;
//destinationServer.ConnectionContext.Password =3tier2;
数据库destinationDatabase = destinationServer.Databases [3tier2];
传输传输=新传送(sourceDatabase);
transfer.CopyAllObjects = FALSE;
transfer.DropDestinationObjectsFirst = FALSE;
transfer.UseDestinationTransaction = TRUE;
transfer.CopyAllDefaults = TRUE;
transfer.Options.Indexes = TRUE;
transfer.Options.DriAll = TRUE;
transfer.CopyAllDefaults = TRUE;
transfer.Options.AnsiFile = TRUE;
transfer.Options.SchemaQualify =真;
transfer.Options.WithDependencies = FALSE;
transfer.CreateTargetDatabase = FALSE;
transfer.CopySchema = TRUE;
transfer.CopyData = TRUE;
transfer.DestinationServer =localhost的;
transfer.DestinationDatabase =3tier2;
transfer.DestinationLoginSecure = FALSE;
transfer.DestinationLogin =3tier2;
transfer.DestinationPassword =3tier2;
transfer.Options.IncludeIfNotExists = TRUE;
transfer.TransferData();
解决方案
我不知道这是否是同样的情况,但我也有类似的问题,这是关系到 SQLTaskConnectionOleDb 类注册的腐败
我已经运行解决了它
REGSVR32为%ProgramFiles%\ Microsoft SQL Server的\ 90 \ DTS \ BINN \ SQLTaskConnections.dll
在命令提示符。
Am getting the same error on the code below using either trusted or SQL logins:
Bombs on the transfer.TransferData
this feels like security. Any thoughts would be awesome!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Collections.Specialized;
using System.IO;
using System.Configuration;
namespace GenerateScripts
{
class Program
{
static void Main(string[] args)
{
ServerConnection sourceConnection = new ServerConnection("localhost");
Server sourceServer = new Server(sourceConnection);
//sourceServer.ConnectionContext.LoginSecure = false;
//sourceServer.ConnectionContext.Login = "3tier";
//sourceServer.ConnectionContext.Password = "3tier";
Database sourceDatabase = sourceServer.Databases["3tier"];
// destination
ServerConnection destinationConnection = new ServerConnection("localhost");
Server destinationServer = new Server(destinationConnection);
//destinationServer.ConnectionContext.LoginSecure = false;
//destinationServer.ConnectionContext.Login = "3tier2";
//destinationServer.ConnectionContext.Password = "3tier2";
Database destinationDatabase = destinationServer.Databases["3tier2"];
Transfer transfer = new Transfer(sourceDatabase);
transfer.CopyAllObjects = false;
transfer.DropDestinationObjectsFirst = false;
transfer.UseDestinationTransaction = true;
transfer.CopyAllDefaults = true;
transfer.Options.Indexes = true;
transfer.Options.DriAll = true;
transfer.CopyAllDefaults = true;
transfer.Options.AnsiFile = true;
transfer.Options.SchemaQualify = true;
transfer.Options.WithDependencies = false;
transfer.CreateTargetDatabase = false;
transfer.CopySchema = true;
transfer.CopyData = true;
transfer.DestinationServer = "localhost";
transfer.DestinationDatabase = "3tier2";
transfer.DestinationLoginSecure = false;
transfer.DestinationLogin = "3tier2";
transfer.DestinationPassword = "3tier2";
transfer.Options.IncludeIfNotExists = true;
transfer.TransferData();
解决方案
I don't know if this is the same case but i had a similar problem and it was related to SQLTaskConnectionOleDb class registration corruption,
i've solved it by running
regsvr32 "%ProgramFiles%\Microsoft SQL Server\90\DTS\Binn\SQLTaskConnections.dll"
in command prompt.
这篇关于SQL Server管理对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!