Thursday, February 16, 2012

[ActiveX Script Task] Error: Retrieving the file name for a component failed with error code 0x0

This error occurs when the ActiveX task tries to execute:

[ActiveX Script Task] Error: Retrieving the file name for a component failed with error code 0x001B6438.

Anybody know how to troubleshoot these errors? I can't find anything on this error code. The same script works in DTS.

I have got the same error, the code is different but couldn't figure out what to do...|||

Hi Igor,

This isn't much of an answer but it is true: you should try to move away from the ActiveX Script Task and use the Script Task instead.

Hope this helps,
Andy

|||Script Task does mean that there is a different scripting language?

I tryed a different thing: I moved all the script from a SSIS task to a SQL Server job (a job with one "activeX script" step).

It sounds great, but I have a different error in the step that says that
"The command script does not destroy all the objects that it creates. Revise the command script. (Microsoft SQL Server, Error: 14277)"

I am not a VB programmer, so I think I have to ask someone to revise the script.

Thanks for the help|||

ActiveX scripts in SQL Jobs (all versions) appear to have a major bug in that they report Error: 14277 whenever the string "createobject(" appears more than once anywhere in the script. It does not matter whether the string is just part of a character expression such as: sTemp = "..... createobject( ...."; whether it appears in a comment or whether it is used to actually create an object. Any combination of the above that puts "createobject(" in the script more than once will cause the 14277 error to appear when you try to close the Job modifier.

There is a trick that I have found to overcome this. That is, to create any and all objects in a single common subroutine. Even in this subroutine, you have to trick the system into thinking that you have just destroyed the object that you are trying to create.

The subroutine is cobj. It takes the variable that will become the object and a string that defines the activex control. The "set ... = Nothing" that appears after the "Exit Sub" is the trick that makes the system think that the object is destroyed within the scope of cobj. Note: be sure to destroy the object in the scope where the object variable was defined.

Here is a code sample that sends an email using ASPMAIL, which contains data from an ADO SQL query.


'*********************************************
' ActiveX Script - no 14277 error
'*********************************************
MailMe readSQL(1006), "mymail@.mail.com"

Sub cobj(newobj, ax)
Set newobj = createobject(ax) ' only appears once, here
exit sub
Set newobj = Nothing ' never executed but tricks checker
End Sub

sub MailMe (sMsg, sAddress)
dim Mailer, vRet
if instr(sAddress,"@.")<1 then exit sub

cobj Mailer, "SMTPsvg.Mailer"

Mailer.FromName = "ASP_Debug"
Mailer.FromAddress = sAddress
Mailer.RemoteHost = "127.0.0.1"
Mailer.AddRecipient "", sAddress
Mailer.Subject = "Debug ActiveX Script - 14277 Error"
Mailer.BodyText = sMsg
Mailer.SendMail
Set Mailer=Nothing
end sub

Function readSQL(ndx)
Dim SQL, sConn, oRst
readSQL = "No Record"
SQL = "SELECT Note FROM NoteTable WHERE [ID]=" & CStr(ndx)
sConn = "Provider=SQLOLEDB.1;Initial Catalog=xx;Data Source=zz"

cobj oRst, "ADODB.Recordset"

oRst.Open SQL, sConn
If oRst.State = 1 Then
readSQL = oRst(0)
oRst.Close
End If
Set oRst = Nothing
End Function

No comments:

Post a Comment