开发者

SSIS 2008 error with Script task

Here is the code I write in my script task but I get the error , Name 'DTS' is not declared

1)Any idea, how to resolve it?

2)Another question, would be , instea开发者_开发知识库d of having "MsgBox(" files found)") " , I would like to send an email as an error , what should I write?

Thanks a lot

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime

Imports System.IO

Public Class ScriptMain

    Public Sub Main()

        If Directory.GetFiles("C:\456").Length = 0 Then
            MsgBox(" files found)")
        Else
            MsgBox("not found)")
        End If
        Dts.TaskResult = Dts.Results.Success
    End Sub
End Class


1) Try to return simply 0 (it stands for Success)

Dts.TaskResult = 0

2) Change MsgBox(" files found") to something like that

Dim client As SmtpClient = new SmtpClient("hostname", 25)
client.Send("from@address.com", "to@address.com", "subject", "body")

In this case do not forget to import the namespace

Imports System.Net.Mail

I'm not sure sending will work, but you can try it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜