iT邦幫忙

0

C# 別台電腦上執行發生錯誤(An Integration Services class cannot be found)

請問各位,寫了一支程式主要是要連接資料庫後新增資料表並插入資料,之後用SSIS轉出excel報表。
測試過在本機使用都沒問題,但是到別台電腦上安裝就碰到許多問題:
程式碼如下(省略冗長SQL語法):

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;       
using QC = System.Data.SqlClient;  
using System.Diagnostics;
using Microsoft.SqlServer.Dts.Runtime;

        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection SqlSvrCon1 = new SqlConnection(strCon);
            SqlSvrCon1.Open();
            SqlCommand objCommand1 = new SqlCommand(SQL1, SqlSvrCon1);
            objCommand1.CommandTimeout = 120;
            objCommand1.ExecuteNonQuery();
            SqlSvrCon1.Close();
            string pkgLocation;
            
            
            
            Package pkg;
            Microsoft.SqlServer.Dts.Runtime.Application app;
            DTSExecResult pkgResults;

            pkgLocation =
            @"C:\20190412001\20190412001\export\Package1.dtsx";
            app = new Microsoft.SqlServer.Dts.Runtime.Application();
            pkg = app.LoadPackage(pkgLocation, null);
            pkgResults = pkg.Execute();
}

https://ithelp.ithome.com.tw/upload/images/20190417/20116501rMYJjqMLdF.png
↑原本有兩個專案,但是我把另一個專案(Integration Services Project)SSIS封裝的.dtsx檔拉過來執行,不曉得有沒有影響在非本機上的執行

到其他電腦上便會發生錯誤
https://ithelp.ithome.com.tw/upload/images/20190417/20116501sWEawS81Lv.png

↑將C:\Windows\Microsoft.NET\assembly\GAC_32***(和64)***\Microsoft.SqlServer.DTSRuntimeWrap的資料拉過去後變成如下錯誤

https://ithelp.ithome.com.tw/upload/images/20190417/20116501jCsWtlvOBx.png
Microsoft.SqlServer.Dts.Runtime.DtsComException: An Integration Services class cannot be found. Make sure that Integration Services is correctly installed on the computer that is running the application. Also, make sure that the 64-bit version of Integration Services is installed if you are running a 64-bit application. ---> System.Runtime.InteropServices.COMException: 擷取元件 (CLSID 為 {4F0FC44B-C99C-441D-B86A-D60D7E22143D}) 的 COM Class Factory 失敗,因為發生下列錯誤: 80040154 類別未登錄 (發生例外狀況於 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))。
於 Microsoft.SqlServer.Dts.Runtime.Application..ctor()
↑這支程式之後是在使用者電腦上使用的,希望不要安裝太多程式(已經要Framwork),但是目前測試的筆電開啟官網的SSDT-Setup-CHT.exe也沒有反應,下載舊版的SSDT也發生錯誤無法安裝,所以想知道針對使用SSIS匯出報表需要那些元件在電腦上才可以正常執行

非常感謝/images/emoticon/emoticon02.gif

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
藍諾
iT邦新手 5 級 ‧ 2019-04-24 19:30:09
最佳解答
  1. 是否有安裝 SQL Server Integration Services ?
  2. 是否有裝對版本 32 or 64 bit ?

參考來源:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/dc7c3351-b07f-4339-b61e-f214e4529436/integration-services-class-cannot-be-found-ssis-sql-server-2014?forum=sqlintegrationservices

fufujane iT邦新手 5 級 ‧ 2019-04-25 09:11:27 檢舉

您好,我測試的電腦已經有特別安裝Integration Services,但是沒有看到選擇32 or 64bit的地方,安裝完之後還是會跳出一樣的錯誤訊息。

我要發表回答

立即登入回答