ActiveX脚本在执行脚本期间遇到运行时错误

时间:2011-11-28 22:01:32

标签: sql-server

我在我的dts包中使用ActiveX脚本任务,这已经工作多年了。但是,自从一周以来,我在调用send函数之前收到以下消息:

  

ActiveX Scripting在执行期间遇到运行时错误   脚本。

服务器:SQL Server 2000 SP4

代码是:

Function Main()
    SendEmail()
    Main = DTSTaskExecResult_Success
End Function

Function SendEmail()
    Dim dt 
    dt = Date
    dim CurrentDate 
    CurrentDate = Month(dt) & "/" & Day( dt ) & "/" & Year(dt)

    Set objMessage = CreateObject("CDO.Message") 
    objMessage.Subject = CurrentDate
    objMessage.From = "xx@xx.net" 
    objMessage.To = "xx@xx.net"  
    objMessage.HTMLBody  = CurrentDate

    '==This section provides the configuration information for the remote SMTP server.
    '==Normally you will only change the server name or IP.
    objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

    'Type of authentication, NONE, Basic (Base64 encoded), NTLM
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

    'Use SSL for the connection (False or True)
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

    'Name or IP of Remote SMTP Server
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xx.xx.net"

    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xx"

    'Your password on the SMTP server
    objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xx"

    'Server port (typically 25)
    objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 

    objMessage.Configuration.Fields.Update

    objMessage.Send
End Function 

0 个答案:

没有答案