Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programming the SQL Server DTS Object Model

Status
Not open for further replies.

paulhuts

Programmer
Jan 7, 2001
14
NZ
Hi,

I am using the DTS object model to create SQL Server DTS packages dynamically from VFP 6

I can create the packages and add connections no problem. However I am encountering a problem when I try to add a Task and Step to the package. The Task is not appearing when I try to view the package in the DTS Designer.
I have added the step before I tried to create the task.(Step & Task Code below)

Anyone out there with any experience in this.

Help much appreciated.

-Paul

***********************************************************
* Create SQL Task
*
PROCEDURE CreateSQLTask
PARAMETERS _Name, _Description, _SQLStatement, _ConnectionID

IF PARAMETERS() <> 4
WAIT WINDOW 'Invalid Number of Parameters'
ENDIF

oTask = oPackage.TASKS.NEW('DTSExecuteSQLTask')
oTask.Name = _Name
oTask.Description = _Description

oCustomTask = oTask.CustomTask
oCustomTask.Name = 'DTSTask_DTSExecuteSQLTask_1'
oCustomTask.Description = ''
oCustomTask.SQLStatement = _SQLStatement
oCustomTask.ConnectionID = _ConnectionID
oCustomTask.CommandTimeout = 0

oPackage.Tasks.Add(oTask)

RELEASE oTask

RETURN
***********************************************************



***********************************************************
* Create Step
*
PROCEDURE CreateStep
PARAMETERS _Name, _Description, _TaskName

oStep = oPackage.STEPS.NEW()
oStep.Name = _Name
oStep.Description = _Description
oStep.ExecutionStatus = 1
oStep.TaskName = _TaskName
oStep.CommitSuccess = .F.
oStep.RollbackFailure = .F.
oStep.ScriptLanguage = &quot;VBScript&quot;
oStep.AddGlobalVariables = .T.
oStep.RelativePriority = 3
oStep.CloseConnection = .F.
oStep.ExecuteInMainThread = .F.
oStep.IsPackageDSORowset = .F.
oStep.JoinTransactionIfPresent = .F.
oStep.DisableStep = .F.

oPackage.Steps.Add(oStep)

RELEASE oStep

RETURN

**********************************************************

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top