Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Integrating DTS with VB problem

Author  Topic 

Doug_Bak
Starting Member

9 Posts

Posted - 2004-11-11 : 13:25:18
I'm in the process of moving code from a DTS Package to a VB Application and running into a problem with part of the code.. can anyone tell me why I'm getting User-Defined type not defined when this executes:

'------------- define Task_Sub2 for task DTSTask_DTSDynamicPropertiesTask_1 (Dynamic Properties Task: Set Values)
Public Sub Task_Sub2(ByVal goPackage As Object)

Dim oTask As DTS.Task
Dim oLookup As DTS.Lookup

Dim oCustomTask2 As DTSCustTasks.DynamicPropertiesTask ' This line failsSet oTask = goPackage.Tasks.New("DTSDynamicPropertiesTask")
Set oCustomTask2 = oTask.CustomTask

oCustomTask2.Name = "DTSTask_DTSDynamicPropertiesTask_1"
oCustomTask2.Description = "Dynamic Properties Task: Set Values"

Dim oAssignment As DTSCustTasks.DynamicPropertiesTaskAssignment
'------- An Assignment is defined here

Set oAssignment = oCustomTask2.Assignments.New
oAssignment.SourceType = 2
oAssignment.SourceQueryConnectionID = -1
oAssignment.SourceGlobalVariable = "TextPAPFileName"
oAssignment.DestinationPropertyID = "'Connections';'Text File (Source)';'OLEDBProperties';'Data Source';'Properties';'Value'"

oCustomTask2.Assignments.Add oAssignment
Set oAssignment = Nothing

'------- An Assignment is defined here

Set oAssignment = oCustomTask2.Assignments.New
oAssignment.SourceType = 2
oAssignment.SourceQueryConnectionID = -1
oAssignment.SourceGlobalVariable = "TextReplFileName"
oAssignment.DestinationPropertyID = "'Connections';'Text File (Source) 2';'OLEDBProperties';'Data Source';'Properties';'Value'"

oCustomTask2.Assignments.Add oAssignment
Set oAssignment = Nothing

'------- An Assignment is defined here

Set oAssignment = oCustomTask2.Assignments.New
oAssignment.SourceType = 2
oAssignment.SourceQueryConnectionID = -1
oAssignment.SourceGlobalVariable = "TextProcritExcelFileName"
oAssignment.DestinationPropertyID = "'Connections';'Microsoft Excel 97-2000';'OLEDBProperties';'Data Source';'Properties';'Value'"

oCustomTask2.Assignments.Add oAssignment
Set oAssignment = Nothing

'------- An Assignment is defined here

Set oAssignment = oCustomTask2.Assignments.New
oAssignment.SourceType = 2
oAssignment.SourceQueryConnectionID = -1
oAssignment.SourceGlobalVariable = "TextProcritExcelFileName"
oAssignment.DestinationPropertyID = "'Tasks';'DTSTask_DTSSendMailTask_1';'Properties';'FileAttachments'"

oCustomTask2.Assignments.Add oAssignment
Set oAssignment = Nothing

goPackage.Tasks.Add oTask
Set oCustomTask2 = Nothing
Set oTask = Nothing

End Sub

tuenty
Constraint Violating Yak Guru

278 Posts

Posted - 2004-11-11 : 14:33:49
I guess you haven't add DTSCustTasks.DynamicPropertiesTask reference to your project

Why are you making the DTS in VB??

*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*
A candle loses nothing by lighting another candle
Go to Top of Page

tomailvenky
Starting Member

7 Posts

Posted - 2010-05-10 : 14:14:47
I have also same problem...I have a Main dts package,In that by using execute package task I will call another child DTS package(see diagram),I am passing paths through global variables,In child package I am getting error , The child DTS is for pumping data into table by reading text files,these text files are dynamic
In child package dynamicpropertiestask---->Text(source)------>TransformDataTask----->ConnectionProperties
Here In dynamicpropertiestask I have 2 global variables one is textfilepath second one is .udl path ,now I need to create another for new text file
My question is how to set global variables in dynamic properties If I click on existing dynamic package it is showing 'Cannot locate the DestinationPropertyID'
'Connections'
'CONTROL_FILE'
'OLEDBProperties'
'DataSource'
'Properties'
'value'

In google I found through vb code how to add global variable,
but I need In dynamic properties task after clicking add how set these values.
Go to Top of Page
   

- Advertisement -