【发布时间】:2015-10-06 21:55:00
【问题描述】:
请看下面的代码片段:
Dim fuzzyLookup As IDTSComponentMetaData100 = pipeline.ComponentMetaDataCollection.[New]()
fuzzyLookup.ComponentClassID = "{5056651F-F227-4978-94DF-53CDF9E8CCB6}"
Dim destDesignTimeComponentFuzzy As IDTSDesigntimeComponent100 = fuzzyLookup.Instantiate()
destDesignTimeComponentFuzzy.ProvideComponentProperties() 'line 4
我已导入以下命名空间:
Microsoft.SqlServer.Dts.Runtime
Microsoft.SqlServer.Dts.Pipeline.Wrapper
Microsoft.SqlServer.Dts.Runtime.Wrapper
我添加了以下参考:
Microsoft.SQLServer.dtspipelinewrap.dll
Microsoft.SQLServer.dtsruntimewrap.dll
Microsoft.SQLServer.manageddts.dll
当我添加 32 位引用时,整个代码都会运行,但是什么也没发生,即 package.execute 什么也不做 - 模糊查找不起作用(因此我相信:https://connect.microsoft.com/SQLServer/feedback/details/634516)
因此,我尝试向上面的 3 个 DLL 添加 64 位引用。然后我在代码的第 4 行得到一个异常:HRESULT: 0xC0048021。为什么在 64 位模式下会出现此异常?
我所做的研究表明组件类 id 是错误的。 64 位模糊查找是否有不同的组件类 ID?
2015 年 7 月 10 日更新
我已经运行了下面的代码:
Public Shared Sub LoopComponents()
Dim fileName As String = "C:\Development\ProgrammaticLookup\64Bit.txt"
Dim application As New Application()
Dim componentInfos As PipelineComponentInfos = application.PipelineComponentInfos
Dim i As Integer = 0
For Each componentInfo As PipelineComponentInfo In componentInfos
i = i + 1
Using fs As New FileStream(fileName, FileMode.Append, FileAccess.Write)
Using sw As New StreamWriter(fs)
sw.WriteLine(componentInfo.Name + vbTab + componentInfo.CreationName)
End Using
End Using
Next
Console.Read()
End Sub
当我在 32 位模式下运行上面的代码时,日志文件中添加了 42 个条目,包括:Fuzzy Lookup DTSTransform.BestMatch.2
当我在 64 位模式下运行代码时,日志文件中只添加了 11 个条目。模糊查找不是条目之一。为什么 64 位模式下缺少组件?
【问题讨论】:
标签: sql-server vb.net visual-studio ssis