我一直在尋找解決方案,現在我仍然無法找到一個。我的腳本組件中有一個連接問題。我需要查詢我的數據庫以檢索要使用的Id,然後將其插入到SSIS腳本組件連接
public override void AcquireConnections(object Transaction)
{
connMgr = base.Connections.Connection;
conn = (SqlConnection)connMgr.AcquireConnection(null);
}
我在此處遇到異常。
System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.SqlClient.SqlConnection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
任何解決方案?
感謝您的答覆,但我的主要問題是,我沒有看到班裏的「DTS」對象。即使我將.dts包含在參考文獻中。 –
答案與腳本組件無關,對此問題提出了問題。而是關於一個略有不同的腳本任務。 –
詳細論述@ MaximV.Pavlov的評論 - 與腳本_component_(存在於Dataflow任務中)有關的問題,而這個答案與腳本_task_(存在於控制流中)有關。 – Sepster