December 23, 2008 at 7:33 pm
It's no mystery - you have to rewrite your code using .NET syntax. I'm afraid that you have some learning to do, as I doubt that people here have the time to do it all for you.
The .NET environment is pleasanter to work in and more powerful, but you do have a bit of a learning curve as you start to use it.
Here is a sample of some code, just to give you an idea of the scale of the difference:
Public Class Script1
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.
Public Sub Main()
'If the import file is empty, return a fail, otherwise success
Dim strConn As String, objConn As New OleDb.OleDbConnection
Dim strFilepath As String, strFilename As String, File As FileIO.FileSystem
Dim SelectCommand As String, objCmd As OleDbCommand
Dim objSourceReader As OleDbDataReader
Dim FieldsOK As Boolean
Try
'Set a progress message
Dts.Events.FireProgress("Contact Import", 0, 0, 0, "Commencing Import Validation", True)
'Does the input file exist? If not, set error message and exit job successfully.
If Not File.FileExists(Dts.Connections("CSV File").ConnectionString) Then
SetVariable("User::MessageText", "Input file empty or non-existent")
Dts.TaskResult = Dts.Results.Success
Exit Try
End If
If File.GetFileInfo(Dts.Connections("CSV File").ConnectionString).Length = 0 Then
SetVariable("User::MessageText", "Input file empty or non-existent")
Dts.TaskResult = Dts.Results.Success
Exit Try
End If
etc etc
Phil
December 23, 2008 at 8:06 pm
December 24, 2008 at 7:37 am
Thanks everyone for your helpful advices.
Munnabhai
December 26, 2008 at 5:59 am
One of the good things about SSIS is that you do not need to use script tasks for everything that you did in DTS. When I first was rewriting DTS packages as SSIS, I had several that had ActiveX in them. All you need to be able to do with the ActiveX is be able to understand what the code is doing. Often times, you will be able to find a SSIS transformation that will do the same job. A Conditional split is a good example. If you can't find a SSIS task to do the job, you will have to tackle the SSIS script task and learn some .net.
Viewing 4 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply