5

MS SQL Server 2000 データベース サーバーで実行する DTS パッケージがあり、ユーザーが自分のマシンからそれを実行する方法が必要です。(パッケージは、アプリケーションによってクライアント マシンに転送されるファイルを作成します。)「Microsoft DTSPackage Object Library」COM 参照をアプリケーションに含めましたが、最初のステップで「無効なクラス文字列」エラーが発生します。パッケージが実行されます。また、SQL Server 2000 ディスクの redist.txt ファイルで指定されているすべての DLL を登録しようとしました。ご意見やご提案をいただければ幸いです。DTS パッケージは非常にシンプルです。SQL データベースから Visual FoxPro テーブルにデータをコピーするだけです。パッケージを実行する私のコードを以下に示します (その多くは、Microsoft の KB 記事 ( http://support.microsoft.)。

        Dim pkg As DTS.Package
        pkg = New DTS.Package
        Dim cpContainer As System.Runtime.InteropServices.ComTypes.IConnectionPointContainer
        cpContainer = CType(pkg, System.Runtime.InteropServices.ComTypes.IConnectionPointContainer)
        Dim cpPoint As System.Runtime.InteropServices.ComTypes.IConnectionPoint
        Dim PES As PackageEventsSink = New PackageEventsSink

        Dim guid As Guid = New Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5")

        cpPoint = Nothing
        cpContainer.FindConnectionPoint(guid, cpPoint)

        Dim intCookie As Integer
        cpPoint.Advise(PES, intCookie)

        pkg.LoadFromSQLServer(DTS_SERVER_NAME, , , DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, dtsPassword, , , dtsName, Nothing)
        If pkg Is Nothing Then Throw New ApplicationException("The DTS Package could not be loaded from the SQL Server.")

        Dim pkgStep As DTS.Step
        For Each pkgStep In pkg.Steps
            pkgStep.Execute()
        Next

        pkg.UnInitialize()
        pkg = Nothing

        cpPoint.Unadvise(intCookie)
        cpPoint = Nothing
        cpContainer = Nothing
        PES = Nothing
4

2 に答える 2

1

ユーザー PC に完全な SQL Enterprise Manager クライアント ツールをテストとしてインストールした場合、正常に実行できますか? 要件が不足している可能性があります。DTS パッケージ自体は、サーバーではなく、ユーザーの PC でローカルに実行されることに注意してください。

于 2010-03-15T18:00:40.170 に答える
0

DLLをREGASM/CODEBASEに登録してみてください

于 2010-08-04T23:26:31.577 に答える