DTSPackage

Feb 7, 2008


I am using a DTS Packeg named DTPkg.. i am invoking this DTS Package from my VB.NET Windows Application ... the code is

Dim oPKG As DTS.Package, oStep As DTS.Step
oPKG = New DTS.Package
Dim sServer As String, sUsername As String, sPassword As String
Dim sPackageName As String, sMessage As String
Dim lErr As Long, sSource As String, sDesc As String

sPackageName = "DTPkg"
oPKG.LoadFromSQLServer(sServer, sUsername, sPassword, , , , , sPackageName)

oPKG.GlobalVariables.Remove("CSN")
oPKG.GlobalVariables.AddGlobalVariable("CSN", TextBox1.Text)

oPKG.GlobalVariables.Remove("FO")
oPKG.GlobalVariables.AddGlobalVariable("FO", TextBox2.Text)

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

' Execute
oPKG.Execute()

' Get Status and Error Message
For Each oStep In oPKG.Steps
If oStep.ExecutionResult = DTS.DTSStepExecResult.DTSStepExecResult_Failure Then
oStep.GetExecutionErrorInfo(lErr, sSource, sDesc)
sMessage = sMessage & "Step """ & oStep.Name & _
""" Failed" & vbCrLf & _
vbTab & "Error: " & lErr & vbCrLf & _
vbTab & "Source: " & sSource & vbCrLf & _
vbTab & "Description: " & sDesc & vbCrLf & vbCrLf
Else
sMessage = sMessage & "Step """ & oStep.Name & _
""" Succeeded" & vbCrLf & vbCrLf
End If
Next
oPKG.UnInitialize()
oStep = Nothing
oPKG = Nothing


In the Package i ve
a) dragged and dropped Microsoft OLEDB object.... set the server name , user name , pwd and database
b) dragged and dropped one destination text file .... in that i want to set the file name to be the value contained in the variable CSN that is passed from the VB.NET Applicaton ... u can see the code abov..
c) Now i need to put a data flow arrow ... in that i ve to give the query to be executed... the query should be
select * from Disbursal where field_officer=FO... this FO is also passed from the Application....

How i can do there ... is there any way ? anybody know ? plz do help me ...
thanx in advance ..

View 1 Replies


ADVERTISEMENT

Passing Parameters To DTSPackage

Feb 6, 2008

Hai
I am havng a DTS Package name MFT_Disb... I am invoking this package from my VB.NET(2003) Application..
What i want to do is ....
1 ) i want to pass a variable named Sl_No from my Application to the DTSPackage ..
How can i pass the parameters to the package ?
2 ) Also i ve a text file named Disb.txt... i want to rename this text file to the value contained in the variable Sl_No...
For renaming the text file i want to write ActiveX Script in the same DTSPackage ... How to write the ActiveX Script ?
How can i rename the text file ?
Anybody knows plz do help me ...
I am new to SQL Server and DTSPackage
Any help appreciated
Thanx in advance

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved