dbTalk Databases Forums  

Failing to register custom dts job correctly?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Failing to register custom dts job correctly? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tore Gylver
 
Posts: n/a

Default Failing to register custom dts job correctly? - 02-02-2004 , 08:03 AM






I have made å custom DTS job in visual basic. I started with the dts export
wizard to save visual basic code for a simple export to excel spreadsheet. I
then wanted to timestamp the filename so that the filename itself contains
the date and time of the actual export, example:
MyExportedExcelFile_2004.02.02_08.15.36.xls. So far the DTS job works as
planned, the filename contains date and time.

So far everything works fine. The problem arise when I make the 2nd. custom
dts job. It is exactly the same as the first one, but exports another set of
data to another timestamped filename.

I register the two dts jobs and they seem to be registered successfully. The
big problem is that when I drag the jobs on to the dts designer surface only
job1 works ok. Job 2 changes its icon when dragged on to the surface,
displays itself as job1 and does exactly the same export task as job1.

I have checked and rechecked that I have not mixed the code of the DLL's.
What could be wrong here.


Regards

Tore Gylver



Here is the Code I use to set up the required properties:

Option Explicit


Implements DTS.CustomTask
Public goPackageOld As New DTS.Package
Public goPackage As DTS.Package2
Private mstrTaskName As String
Private mstrDescription As String
Private mstrMessage As String



Private Property Get CustomTask_Properties() As DTS.Properties
'Set CustomTask_Properties = Nothing
End Property

Private Property Get CustomTask_Description() As String
'Implements Task.Description.
CustomTask_Description = mstrDescription
End Property

Private Property Let CustomTask_Description(ByVal strNewDescr As String)
'Implements Task.Description.
mstrDescription = strNewDescr
End Property

Private Property Get CustomTask_Name() As String
'Implements Task.Name.
CustomTask_Name = mstrTaskName
End Property

Private Property Let CustomTask_Name(ByVal strNewName As String)
'Implements Task.Name.
mstrTaskName = strNewName
End Property

Public Property Get Message() As String
'Implements CustTask.Message.
Message = mstrMessage
End Property

Public Property Let Message(ByVal strNewMsg As String)
'Implements CustTask.Message.
mstrMessage = strNewMsg
End Property

Public Property Get Description() As String
'Implements CustTask.Description.
Description = mstrDescription
End Property

Public Property Let Description(ByVal strNewDescr As String)
'Implements CustTask.Description.
mstrDescription = strNewDescr
End Property

Private Sub CustomTask_Execute(ByVal pPackage As Object, ByVal
pPackageEvents As Object, _
ByVal pPackageLog As Object, pTaskResult As
DTS.DTSTaskExecResult)
'MsgBox "Minimum custom task!", vbExclamation
pTaskResult = DTSTaskExecResult_Success
'End Sub

'Here I start calculating the filename:
Dim oFilename As Variant, oyear As Variant, omonth As Variant, _
oday As Variant, ohour As Variant, ominute As Variant, osecond As
Variant

oyear = Year(Date)

omonth = Month(Date)
If Len(omonth) = 1 Then
omonth = "0" & omonth
End If

oday = Day(Date)
If Len(oday) = 1 Then
oday = "0" & oday
End If

ohour = Hour(Time)
If Len(ohour) = 1 Then
ohour = "0" & ohour
End If

ominute = Minute(Time)
If Len(ominute) = 1 Then
ominute = "0" & ominute
End If

osecond = Second(Time)
If Len(osecond) = 1 Then
osecond = "0" & osecond
End If

oFilename = "C:\Inetpub\ftproot\ADSLFremtidigeOrdre_" & oyear & "."
& omonth & "." & oday & "_" & ohour & "." & ominute & "." & osecond & ".xls"

'************************************************* ************************
'From this point I use a standard visual basic code from the DTS export
wizard
'I onlu substitute the export path and filename with ofilename above
'************************************************* ***************
'Microsoft SQL Server 2000
'Visual Basic file generated for DTS Package
'File Name: C:\Documents and Settings\Administrator\My
Documents\ADSLFremtidigeOrdre.bas
'Package Name: ADSLFremtidigeOrdre
'Package Description: Overføring av fremtidige ordre
'Generated Date: 27.01.2004
'Generated Time: 13:49:12
'************************************************* ***************


'Public goPackageOld As New DTS.Package
'Public goPackage As DTS.Package2
'Private Sub Main()
Set goPackage = goPackageOld





Reply With Quote
  #2  
Old   
Russel Loski, MCSD
 
Posts: n/a

Default RE: Failing to register custom dts job correctly? - 02-02-2004 , 01:46 PM






Do both of the custom task dll's have the same ProgID?

Russel Loski, MCSD

Reply With Quote
  #3  
Old   
Tore Gylver
 
Posts: n/a

Default Re: Failing to register custom dts job correctly? - 02-02-2004 , 04:23 PM



I found out myself. The reason for my trouble was that I had created two
classes in two different DLLs. The two classes had the same name (Class1). I
had not bothered to change from the default name in Microsoft Visual Studio
6.0.

When I changed the class names into something more meaningful, and they were
different, then everything seems to work OK.

Tore



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.