April 8, 2004 at 8:48 am
are there any examples out there to edit a DTS package using .NET (either VB or C#)? I am trying to edit a ExecuteSQLTask2 inside a packge object (using Gert Drapers method of executing DTS through .NET). i can instantiate and execute the package, but cannot access the tasks inside the package. my goal is to load the package, access an ExecuteSQLTask2 task, edit the sql text, and either save/execute the package.
any help/links would be appreciated.
April 9, 2004 at 7:49 am
Try using something like what is shown below in an ActiveX Script task.
You should be able to apply this concept to any task.
(Also, check out http://www.SQLDTS.com)
Option Explicit
Function Main()
Dim objPkg
Dim objDataPump
Dim mySQL
'Alter SQL statement
mySQL = "SELECT …"
' Get reference to the DataPump Task
Set objPkg = DTSGlobalVariables.Parent
Set objDataPump = objPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask
' Assign SQL Statement to Source of DataPump
objDataPump.SourceSQLStatement = mySQL
' Clean Up
Set objDataPump = Nothing
Set objPkg = Nothing
Main = DTSTaskExecResult_Success
End Function
April 12, 2004 at 9:33 am
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply