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