• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2255
  • Last Modified:

Cannot Create ActiveX Component

I have the below script in a SSIS package and it keeps giving me the error cannot create activex component.  I'm using sql server 2005 ssis package and chilkat ftp2.  Is there error in the below code?
' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic
' The ScriptMain class is the entry point of the Script Task.
Option Strict Off
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
    ' The execution engine calls this method when the task executes.
    ' To access the object model, use the Dts object. Connections, variables, events,
    ' and logging features are available as static members of the Dts class.
    ' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
    ' To open Code and Text Editor Help, press F1.
    ' To open Object Browser, press Ctrl+Alt+J.
    '  Visual Basic ActiveX Script
    Public Sub Main()
        Dim FileName
        Dim fso
        Dim componentStatus
        Dim ftp
        Dim connectStatus
        Dim dirStatus
        Dim localFile
        Dim remoteFile
        Dim transferStatus
        Dim d
        Dim m
        Dim y
        FileName = "C:\Documents and Settings\xstrat\My Documents\Strat\test.txt"
        fso = CreateObject("Scripting.FileSystemObject")
        ftp = CreateObject("Chilkat.Ftp2")
        componentStatus = ftp.UnlockComponent("test")
        If (componentStatus <> 1) Then
            'MsgBox ftp.LastErrorText
            Dts.TaskResult = Dts.Results.Failure
            'ftp.Hostname = "ftp.test.com"
            ftp.Hostname = ""
            ftp.Username = "test"
            ftp.Password = "test"
            ftp.Port = 21
            ' The default data transfer mode is "Active" as opposed to "Passive".
            ' Change it to Passive by setting the Passive property:
            ftp.Passive = 1
            '  Establish an AUTH SSL secure channel after connection
            '  on the standard FTP port 21.
            ftp.AuthTls = 1
            '  The Ssl property is for establishing an implicit SSL connection
            '  on port 990.  Do not set it.
            ftp.Ssl = 0
            '  Connect and login to the FTP server.
            connectStatus = ftp.Connect()
            If (connectStatus <> 1) Then
                'MsgBox ftp.LastErrorText
                Dts.TaskResult = Dts.Results.Failure
                'MsgBox("Secure FTP Channel Established!")
                dirStatus = ftp.ChangeRemoteDir("File Uploads/Customer Uploads/test")
                If (dirStatus <> 1) Then
                    Dts.TaskResult = Dts.Results.Failure
                    'MsgBox("Remote Dir:" & dirStatus)
                    'MsgBox("File Exists:" & fso.FileExists("C:\Documents and Settings\xstrat\My Documents\Strat\test.txt"))
                    localFile = "C:\Documents and Settings\xstrat\My Documents\Strat\test.txt"
                    remoteFile = "test.txt"
                    '---------------------    BEGIN  Uploading Files  --------------------
                    transferStatus = ftp.PutFile(localFile, remoteFile)
                    '---------------------    END  Uploading Files     --------------------
                    '---------------------     BEGIN  Downloading Files  --------------------
                    'transferStatus = ftp.GetFile(remoteFile, localFile)
                    '---------------------     END  Downloading Files     --------------------
                    If (transferStatus <> 1) Then
                        Dts.TaskResult = Dts.Results.Failure
                        'delete the local payments.csv file
                        Dts.TaskResult = Dts.Results.Success
                    End If
                End If
            End If
        End If
        'Main = DTSTaskExecResult_Success
        d = DateTime.Now.Day
        m = DateTime.Now.Month
        y = DateTime.Now.Year
        If Len(d) = 1 Then d = "0" & d
        If Len(m) = 1 Then m = "0" & m
        fso.copyfile("C:\Documents and Settings\xstrat\My Documents\Strat\test.txt", "C:\Documents and Settings\xstrat\My Documents\Strat\done\test_" & m & d & y & ".txt")
        fso.DeleteFile("C:\Documents and Settings\xstrat\My Documents\Strat\test.txt")
        Dts.TaskResult = Dts.Results.Success
    End Sub
End Class

Open in new window

Nathan Riley
Nathan Riley
  • 6
  • 5
1 Solution
The machine your are executing it has the object Chilkat.Ftp2? (Is a DLL, correct?)

Nathan RileyFounder/CTOAuthor Commented:
Yes it does.  But it is in the Program Files (x86) directory instead of the Program Files dir because this is a 64 bit system, does that matter?
you can open the package from visual studio in the machine?
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

Nathan RileyFounder/CTOAuthor Commented:
Yep and all the other steps work fine like calling the SP and creating the .txt file I want to ftp but then dies on the ftp step.  I wonder do I need to register the .dll maybe since it is in a different location than normal 32 bit?
And from Visual Studio works?
You have the reference in the script component?
Nathan RileyFounder/CTOAuthor Commented:
No the code above is all I have in the script component
CHeck if you have the reference in project explorer of script.
Check image
Nathan RileyFounder/CTOAuthor Commented:
I show a script component in there, but nothing about the Chilkat.Ftp2.dll
Nathan RileyFounder/CTOAuthor Commented:
Here is a ss when I try to hit the add button for script component nothing seems to happen
your package is not finding the object... your problem is here.
Try to register the object again
Nathan RileyFounder/CTOAuthor Commented:
how with regsvr32?  I've tried that and it just keeps returning:

DllRegisterServer in Chilkat.Ftp2.dll failed.
Return code was: 0x8002801c

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now