C# SQL Server管理对象
我使用受信任或SQL登录在以下代码上遇到相同错误: VS2010,控制台应用程序.NET4,WinXP。SQL2005完整版 炸弹在传送。传送数据 错误:errorCode=-1073548784 description=执行查询“” 失败,错误如下:“检索的COM类工厂” CLSID为{19E353EF-DAF4-45D8-9A04-FB7F7798DCA7}的组件由于以下原因失败 到以下错误:80040154。“。可能的故障原因:问题 查询时,“ResultSet”属性设置不正确,参数设置不正确 设置正确,或未正确建立连接 这感觉像是安全感。任何想法都会很棒C# SQL Server管理对象,c#,.net-4.0,ssms,C#,.net 4.0,Ssms,我使用受信任或SQL登录在以下代码上遇到相同错误: VS2010,控制台应用程序.NET4,WinXP。SQL2005完整版 炸弹在传送。传送数据 错误:errorCode=-1073548784 description=执行查询“” 失败,错误如下:“检索的COM类工厂” CLSID为{19E353EF-DAF4-45D8-9A04-FB7F7798DCA7}的组件由于以下原因失败 到以下错误:80040154。“。可能的故障原因:问题 查询时,“ResultSet”属性设置不正确,参数设置不
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();
我不知道这是否是同一个案例,但我有一个类似的问题,它与SQLTaskConnectionOleDb类注册损坏有关 我通过跑步解决了这个问题
regsvr32 "%ProgramFiles%\Microsoft SQL Server\90\DTS\Binn\SQLTaskConnections.dll"
在命令提示符中