dbTalk Databases Forums  

Trapping a Sql2000 DTS error

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


Discuss Trapping a Sql2000 DTS error in the microsoft.public.sqlserver.dts forum.



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

Default Trapping a Sql2000 DTS error - 11-16-2006 , 12:03 PM






I inherited some code that executes a DTS package that pulls from a site in
Australia. Works great, unless someone in Oz decides to turn off our access,
in which case login fails.

When we run it from inside Enterprise Manager, we are dutifully informed
what happened. When we run it from a VB6 app using the code below, no error
is thrown:

On Error GoTo error_hander
Dim oPackage As New DTS.Package

oPackage.LoadFromSQLServer sServername, , , _
DTSSQLStgFlag_UseTrustedConnection, , , , sPackagename


oPackage.Execute

'Clean up.
Set oPackage = Nothing
FireDTS = True

Exit Function
error_hander:
MsgBox "Error occured", vbCritical
FireDTS = False
End Function

Is this the expectation, or are we doing something wrong?

I recently found http://support.microsoft.com/?kbid=221193, which I will try
out next week. My question is whether this is the best approach, or whether
I should be doing something different.

TIA!

John

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Trapping a Sql2000 DTS error - 11-16-2006 , 03:29 PM






Hello John,

You are using EM which is simply a client and captures the events.

In your app I would look also to capture events rather than simply firing
the package. Have a look at gert's site for examples

www.SQLDEV.net


Regards

Allan Mitchell
Konesans Ltd
T +44 7966 476 572
F +44 2071 008 479
http://www.konesans.com

Quote:
I inherited some code that executes a DTS package that pulls from a
site in Australia. Works great, unless someone in Oz decides to turn
off our access, in which case login fails.

When we run it from inside Enterprise Manager, we are dutifully
informed what happened. When we run it from a VB6 app using the code
below, no error is thrown:

On Error GoTo error_hander
Dim oPackage As New DTS.Package
oPackage.LoadFromSQLServer sServername, , , _
DTSSQLStgFlag_UseTrustedConnection, , , , sPackagename
oPackage.Execute

'Clean up.
Set oPackage = Nothing
FireDTS = True
Exit Function
error_hander:
MsgBox "Error occured", vbCritical
FireDTS = False
End Function
Is this the expectation, or are we doing something wrong?

I recently found http://support.microsoft.com/?kbid=221193, which I
will try out next week. My question is whether this is the best
approach, or whether I should be doing something different.

TIA!

John




Reply With Quote
  #3  
Old   
Peter Yang [MSFT]
 
Posts: n/a

Default RE: Trapping a Sql2000 DTS error - 11-16-2006 , 08:57 PM



Hello John,

I understand that you'd like to be informed what happed in VB program
executing DTS package. If I'm off-base, please let's know.

You may try the following steps to add event handling of DTS package in VB
code:

1. Open the module code
2. Select the entire module contents, cut, and paste into the Form1 code
module
3. Remove the no-longer-needed module from the project
4. Return to the Form1 code window that now contains all the code. If you
didn't paste over the existing contents, remove the duplicate "Option
Explicit".
5. Change the code such as

Public goPackageOld As New DTS.Package to

Public WithEvents goPackageOld as DTS.Package


6. Add as the very first line of Sub Main
Set goPackageOld = New DTS.Package

7. Using the 2 dropdowns at the top of the code window, add and event
handler stub for each of the goPackageOld object's 5 available events, one
after another. You must enter something, if only a comment using ' , in
each Sub/End Sub block.

8. Use MsgBox or Debug.Print in the appropriate event handlers to give
useful feedback on the events occurring.

9. Finally, create a Form_Load event for the form and call the Main
function in that event. Or, if you prefer, put a Command Button on the form
and call the Main function in its Click event.

Please see the following articles for detailed information:

How to install Data Transformation Services (DTS) Event Handlers in Visual
Basic
http://support.microsoft.com/kb/221193

321525 HOW TO: Use DTS Package Events in Visual Basic .NET
http://support.microsoft.com/default...b;EN-US;321525

If you have further questions on the issue, please feel free to let's know.
Thank you.

Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications
<http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx>.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
<http://msdn.microsoft.com/subscriptions/support/default.aspx>.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #4  
Old   
Peter Yang [MSFT]
 
Posts: n/a

Default RE: Trapping a Sql2000 DTS error - 11-20-2006 , 09:39 PM



Hello John,

I'm still interested in this issue. If you have any comments or questions,
please feel free to let's know. We look forward to hearing from you.

Best Regards,

Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support


================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====



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.