I have a DTS package that runs on our MS SQL Server 2000 database server, and need a way for users to execute it from their own machines. (The package creates files that are then transferred by my application to the client machine.) I have included the "Microsoft DTSPackage Object Library" COM reference in the application, but still get an "Invalid Class String" error when the first step of the package is executed. I have also tried registering all the DLLs specified in the redist.txt file of the SQL Server 2000 disc. Any thoughts or suggestions would be greatly appreciated. The DTS package is very simple. It just copies data from the SQL database into Visual FoxPro tables. My code that executes the package is below (much of it is taken from Microsoft's KB article: http://support.microsoft.com/kb/321525).
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