dbTalk Databases Forums  

COM problem calling DTS from vb.net

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


Discuss COM problem calling DTS from vb.net in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mike Voissem
 
Posts: n/a

Default COM problem calling DTS from vb.net - 02-09-2006 , 03:53 PM






I was looking for a way to collect dts run information (errors, progress,
etc). I found this article
http://support.microsoft.com/default...b;en-us;321525
I did exactly as it suggested, and I receive an error at the following point:
cpContainer.FindConnectionPoint(guid, cpPoint)
The error is "no such interface supported"

I'm running Windows XP Pro with the latest service pack, and using VS2003
Below is the sample from that link above.
1. Open Visual Studio .NET, create a new Visual Basic Console Application
project, and then open the code window for the default Module1.
2. Set a reference to the DTSPackage Object (COM) Library , and insert the
following Imports statements at the top of the module:Imports
System.Runtime.InteropServices
Imports DTS


3. Insert the following code in the Sub Main procedure: Dim pkg As
DTS.Package
Try
pkg = New DTS.Package()
'Begin - set up events sink
Dim cpContainer As UCOMIConnectionPointContainer
cpContainer = CType(pkg, UCOMIConnectionPointContainer)
Dim cpPoint As UCOMIConnectionPoint
Dim PES As PackageEventsSink = New PackageEventsSink()
Dim guid As Guid = _
New Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5")
cpContainer.FindConnectionPoint(guid, cpPoint)
Dim intCookie As Integer
cpPoint.Advise(PES, intCookie)
'End - set up events sink
pkg.LoadFromSQLServer("<server>", "<user>", "<password>", _
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _
"", "", "", "<package name>", Nothing)
Console.WriteLine("PACKAGE EXECUTION BEGINNING")
pkg.Execute()
Console.WriteLine("PACKAGE EXECUTION COMPLETED")
Console.WriteLine("The package contained {0} steps.", _
pkg.Steps.Count.ToString)
pkg.UnInitialize()
pkg = Nothing
cpPoint.Unadvise(intCookie)
cpPoint = Nothing
cpContainer = Nothing
PES = Nothing
Catch exc As System.Runtime.InteropServices.COMException
Console.WriteLine(exc.Message)
Catch exc As Exception
Console.WriteLine(exc.Message)
Finally
Console.ReadLine()
End Try


4. Select or create a DTS package for use in this test, and then edit the
values as appropriate in the LoadFromSQLServer method for the server name,
user ID, password, and package name.
5. Under the End Module statement, insert the following events sink class to
handle the DTS Package events:Public Class PackageEventsSink
Implements DTS.PackageEvents
Overridable Overloads Sub OnError(ByVal EventSource As String, _
ByVal ErrorCode As Integer, ByVal Source As String, _
ByVal Description As String, ByVal HelpFile As String, _
ByVal HelpContext As Integer, ByVal IDofInterfaceWithError As
String, _
ByRef pbCancel As Boolean) Implements DTS.PackageEvents.OnError
Console.WriteLine(" OnError in {0}; ErrorCode = {1}, Source = {2},"
& _
" Description = {3}", EventSource, ErrorCode, Source, Description)
End Sub
Overridable Overloads Sub OnFinish(ByVal EventSource As String) _
Implements DTS.PackageEvents.OnFinish
Console.WriteLine(" OnFinish in {0}", EventSource)
End Sub
Overridable Overloads Sub OnProgress(ByVal EventSource As String, _
ByVal ProgressDescription As String, ByVal PercentComplete As
Integer, _
ByVal ProgressCountLow As Integer, ByVal ProgressCountHigh As
Integer) _
Implements DTS.PackageEvents.OnProgress
Console.WriteLine(" OnProgress in {0}; ProgressDescription = {1}", _
EventSource, ProgressDescription)
End Sub
Overridable Overloads Sub OnQueryCancel(ByVal EventSource As String, _
ByRef pbCancel As Boolean) Implements
DTS.PackageEvents.OnQueryCancel
If EventSource.Length > 0 Then
Console.WriteLine(" OnQueryCancel in {0}; pbCancel = {1}", _
EventSource, pbCancel.ToString)
Else
Console.WriteLine(" OnQueryCancel; pbCancel = {0}",
pbCancel.ToString)
End If
pbCancel = False
End Sub
Overridable Overloads Sub OnStart(ByVal EventSource As String) _
Implements DTS.PackageEvents.OnStart
Console.WriteLine(" OnStart in {0}", EventSource)
End Sub
End Class


6. Run the package and observe the sequence of steps and events. Click Enter
to close the console window and quit the program.

--
Mike Voissem
Lead Software Engineer
Donnelley Marketing

Reply With Quote
  #2  
Old   
Mike Voissem
 
Posts: n/a

Default RE: COM problem calling DTS from vb.net - 02-09-2006 , 04:30 PM






How stupid am I?
I "assumed" that I was to enter the GUID of the DTS package. I tried
changing the GUID to what the sample had, and it worked.
--
Mike Voissem
Lead Software Engineer
Donnelley Marketing


"Mike Voissem" wrote:

Quote:
I was looking for a way to collect dts run information (errors, progress,
etc). I found this article
http://support.microsoft.com/default...b;en-us;321525
I did exactly as it suggested, and I receive an error at the following point:
cpContainer.FindConnectionPoint(guid, cpPoint)
The error is "no such interface supported"

I'm running Windows XP Pro with the latest service pack, and using VS2003
Below is the sample from that link above.
1. Open Visual Studio .NET, create a new Visual Basic Console Application
project, and then open the code window for the default Module1.
2. Set a reference to the DTSPackage Object (COM) Library , and insert the
following Imports statements at the top of the module:Imports
System.Runtime.InteropServices
Imports DTS


3. Insert the following code in the Sub Main procedure: Dim pkg As
DTS.Package
Try
pkg = New DTS.Package()
'Begin - set up events sink
Dim cpContainer As UCOMIConnectionPointContainer
cpContainer = CType(pkg, UCOMIConnectionPointContainer)
Dim cpPoint As UCOMIConnectionPoint
Dim PES As PackageEventsSink = New PackageEventsSink()
Dim guid As Guid = _
New Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5")
cpContainer.FindConnectionPoint(guid, cpPoint)
Dim intCookie As Integer
cpPoint.Advise(PES, intCookie)
'End - set up events sink
pkg.LoadFromSQLServer("<server>", "<user>", "<password>", _
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _
"", "", "", "<package name>", Nothing)
Console.WriteLine("PACKAGE EXECUTION BEGINNING")
pkg.Execute()
Console.WriteLine("PACKAGE EXECUTION COMPLETED")
Console.WriteLine("The package contained {0} steps.", _
pkg.Steps.Count.ToString)
pkg.UnInitialize()
pkg = Nothing
cpPoint.Unadvise(intCookie)
cpPoint = Nothing
cpContainer = Nothing
PES = Nothing
Catch exc As System.Runtime.InteropServices.COMException
Console.WriteLine(exc.Message)
Catch exc As Exception
Console.WriteLine(exc.Message)
Finally
Console.ReadLine()
End Try


4. Select or create a DTS package for use in this test, and then edit the
values as appropriate in the LoadFromSQLServer method for the server name,
user ID, password, and package name.
5. Under the End Module statement, insert the following events sink class to
handle the DTS Package events:Public Class PackageEventsSink
Implements DTS.PackageEvents
Overridable Overloads Sub OnError(ByVal EventSource As String, _
ByVal ErrorCode As Integer, ByVal Source As String, _
ByVal Description As String, ByVal HelpFile As String, _
ByVal HelpContext As Integer, ByVal IDofInterfaceWithError As
String, _
ByRef pbCancel As Boolean) Implements DTS.PackageEvents.OnError
Console.WriteLine(" OnError in {0}; ErrorCode = {1}, Source = {2},"
& _
" Description = {3}", EventSource, ErrorCode, Source, Description)
End Sub
Overridable Overloads Sub OnFinish(ByVal EventSource As String) _
Implements DTS.PackageEvents.OnFinish
Console.WriteLine(" OnFinish in {0}", EventSource)
End Sub
Overridable Overloads Sub OnProgress(ByVal EventSource As String, _
ByVal ProgressDescription As String, ByVal PercentComplete As
Integer, _
ByVal ProgressCountLow As Integer, ByVal ProgressCountHigh As
Integer) _
Implements DTS.PackageEvents.OnProgress
Console.WriteLine(" OnProgress in {0}; ProgressDescription = {1}", _
EventSource, ProgressDescription)
End Sub
Overridable Overloads Sub OnQueryCancel(ByVal EventSource As String, _
ByRef pbCancel As Boolean) Implements
DTS.PackageEvents.OnQueryCancel
If EventSource.Length > 0 Then
Console.WriteLine(" OnQueryCancel in {0}; pbCancel = {1}", _
EventSource, pbCancel.ToString)
Else
Console.WriteLine(" OnQueryCancel; pbCancel = {0}",
pbCancel.ToString)
End If
pbCancel = False
End Sub
Overridable Overloads Sub OnStart(ByVal EventSource As String) _
Implements DTS.PackageEvents.OnStart
Console.WriteLine(" OnStart in {0}", EventSource)
End Sub
End Class


6. Run the package and observe the sequence of steps and events. Click Enter
to close the console window and quit the program.

--
Mike Voissem
Lead Software Engineer
Donnelley Marketing

Reply With Quote
  #3  
Old   
newsreader54@web.de
 
Posts: n/a

Default Re: COM problem calling DTS from vb.net - 02-23-2006 , 08:02 AM



Thanks for publishing your experience. Helped me a little bit.

Peter


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.