Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


VB to VB.Net for SSIS Logging


VB to VB.Net for SSIS Logging

Author
Message
jglayden
jglayden
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 123
I am currently converting old DTS packages to SSIS (SQL Server 2005) and would like to use this simple form to log each process that is completed. I understand that I can use a VB script task, but can someone help me convert this to .Net in order for this to work. Or is there a better script that can give me basic logging to a file and send an email message. I use SSIS logging for some of the packages that I have converted over, but as many people write, it isn't the best to just know what packages are currently running and to quickly see the start and finish time. Thanks for everyone's help.

--Beginning of the DTS

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()


'************************************************************************
' Local variable definitions
'************************************************************************

dim objMail
Const ForReading = 1, ForWriting = 2, ForAppending = 8
dim fso,log

'************************************************************************
' initialize local variables
'************************************************************************

Set objMail = CreateObject("CDO.Message")
objMail.Subject = "Nightly Master Job has started"
objMail.From = "xxx@xxxxx.com"
objMail.To = DTSGlobalVariables("gEmail").Value
objMail.TextBody = "The job started running at " & Now()

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

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

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

'Sets up NTLM authentication using the credentials of the running thread

objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2


objMail.Configuration.Fields.Update

' msgbox "pre-send"

' On Error Resume Next

objMail.Send

' msgbox Err.Description

Set objMail = Nothing

set fso = CreateObject("Scripting.FileSystemObject")

DTSGlobalVariables("logFile").Value = "D:\Master_DTSightly_master_job_log_" & Year(Now) & Month(Now) & Day(Now) & ".txt"
' msgbox DTSGlobalVariables("logFile").Value

if not fso.FileExists(DTSGlobalVariables("logFile").Value) then fso.CreateTextFile DTSGlobalVariables("logFile").Value, true end if
set log = fso.OpenTextFile(DTSGlobalVariables("logFile").Value, ForAppending)

log.WriteLine("[" & NOW &"]" & vbTab & "Nightly Master Job Started!")
returnStatus = DTSTaskExecResult_Failure

Main = DTSTaskExecResult_Success
End Function


--End of the DTS

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()
Const ForReading = 1, ForWriting = 2, ForAppending = 8

dim fso,log
set fso = CreateObject("Scripting.FileSystemObject")

if not fso.FileExists(DTSGlobalVariables("logFile").Value) then fso.CreateTextFile DTSGlobalVariables("logFile").Value, true end if
set log = fso.OpenTextFile(DTSGlobalVariables("logFile").Value, ForAppending)

log.WriteLine("[" & NOW &"]" & vbTab & "Nightly Master Job Completed Successully!")
returnStatus = DTSTaskExecResult_Failure


Main = DTSStepScriptResult_ExecuteTask
End Function
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search