SQL Server Performance

having trouble with this ActiveX script

Discussion in 'SQL Server DTS-Related Questions' started by Will192, Mar 20, 2007.

  1. Will192 New Member

    I am having trouble getting this script working in my ActiveX task:

    Dim iConf As New CDO.Configuration
    Dim Flds As ADODB.Fields
    Set Flds = iConf.Fields
    Flds(cdoLanguageCode) = "en-us"
    Flds(CDO.cdoTimeZoneIDURN) = cdoMountain
    Dim iMsg As New CDO.Message
    Set iMsg.Configuration = iConf

    What I am trying to do is set the time zone for the message. All of the messages that my server generates through CDO are an hour off. Here is what I have so far, but it generates an error on the 2nd and 3rd Set Flds. commands.

    Dim iConf
    Set iConf = CreateObject("CDO.Configuration")
    Dim Flds
    Set Flds = iConf.Fields
    Set Flds.cdoLanguageCode = "en-us"
    Set Flds.cdoTimeZoneIDURN = 11
    ' 11 is value for Central time

    Dim objMail
    Set objMail = CreateObject("CDO.Message")
    Set objMail.Configuration = iConf

    objMail.From = " email address goes here"
    objMail.To = "my email address goes here"
    objMail.Subject="Email from Server"
    objMail.TextBody = "This was sent from a DTS job on Server"
    Set objMail = nothing

    Main = DTSTaskExecResult_Success
    End Function

    The error that I am getting is:
    Object doesn't suppport this property or method:'cdoLanguageCode'

    Thanks in advance for any responses to this post.

    Live to Throw
    Throw to Live
  2. Adriaan New Member

    In VB dialects, you use SET for setting object variables, not for assigning values.

    Set Flds.cdoLanguageCode = "en-us"
    Set Flds.cdoTimeZoneIDURN = 11
  3. Will192 New Member

    I just made the change that you suggested and I still get the same error. DTS ActiveX uses VB script. I am not a VB expert by any means so I don't know the exact converion of the above code to what I need.

    Live to Throw
    Throw to Live
  4. Adriaan New Member

    I wonder about the mail object's Configuration property - perhaps it needs a file name instead of an object?

    Set objMail.Configuration = iConf.<filename>

Share This Page