dbTalk Databases Forums  

Re: DTS and VB.net....Capturing return value

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


Discuss Re: DTS and VB.net....Capturing return value in the microsoft.public.sqlserver.dts forum.



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

Default Re: DTS and VB.net....Capturing return value - 08-18-2005 , 05:59 PM






ninel wrote:
Quote:
I am executing a DTS package from vb.net. This package executes a
stored proc which is supposed to return a return value.

Here is my .net code:


Dim oPkg As DTS.Package2
Dim oStep As DTS.Step2
Dim results As Boolean

results = True
oPkg = New DTS.Package2

oPkg.LoadFromSQLServer(ServerName:="NINEL-D246655F1",
ServerUserName:="timecontroluser",
ServerPassword:="timecontroluser", PackageName:="ExportTSRLog")

oPkg.GlobalVariables.Remove("sCalldate")
oPkg.GlobalVariables.AddGlobalVariable("sCalldate" ,
sCalldate)

For Each oStep In oPkg.Steps
oStep.ExecuteInMainThread = True
Next

oPkg.FailOnError = True
oPkg.Execute()

For Each oStep In oPkg.Steps
If oStep.ExecutionResult =
DTS.DTSStepExecResult.DTSStepExecResult_Failure Then
results = False
End If
Next

If results = True Then
lblResult.Visible = True
lblResult.Text = "TSRLogs have been exported"
End If
oPkg.UnInitialize()
oStep = Nothing
oPkg = Nothing


ExecuteDTS = results

I can not figure out how to capture this value on the vb.net side.
Do I need to do something special in the DTS package aside from just
setting the reeturn value in the stored procedure?

Can anyone help?

Thanks,
Ninel

To execute a proc and get a return value, why not use ADO.Net? I assume
you are doing more than that, so you still want DTS.

Forget about .Net for a minute, and set tech Exec SOL Task to return the
proc return code to a global variable. Once that is working, adjust the
..Net code to read the global variable post execution.

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com


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.