代码之家  ›  专栏  ›  技术社区  ›  Dave Mateer

SQL Server管理对象

  •  6
  • Dave Mateer  · 技术社区  · 14 年前

    我使用受信任或SQL登录在以下代码上遇到相同错误:

    VS2010,控制台应用程序.NET4,Win XP。SQL2005已满。

    传送炸弹。传送数据

    错误:errorCode=-1073548784 description=执行查询“” CLSID为{19E353EF-DAF4-45D8-9A04-FB7F7798DCA7}的组件由于以下原因失败 到以下错误:80040154“。可能的故障原因:问题 设置正确,或连接建立不正确。

    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();
    
    1 回复  |  直到 11 年前
        1
  •  2
  •   Ginka    13 年前

    我不知道这是否是同样的情况,但我有一个类似的问题,这是有关 SQLTaskConnectionOleDb 班级登记腐败,

    regsvr32 "%ProgramFiles%\Microsoft SQL Server\90\DTS\Binn\SQLTaskConnections.dll"
    

    在命令提示符下。