all groups > sql server dts > april 2004 >
You're in the

sql server dts

group:

Passing parameters in front-end



Passing parameters in front-end Kaspian
4/26/2004 11:31:03 PM
sql server dts: Hi

I am a newbie to DTS. What I am doing now is I have created a set of DTS packages, which are executed one from another. I am now preparing a frontend for the users to run the packages for themselves. I found examples on how to do that, but what I need to do is make the users pass parameters to the executed package. I also now how to do that from within the enterprise manager. What I'm a little fuzzy about is how to combine those two examples I found; that is, how to pass the entered parameters in the code of the frontend and start the package at the same time

I do not want the code to start all the tasks in the packages for me. All I want is to pass the parameters AND execute the first package, which will then execute the rest - as there are no more parameters to pass or obtain later on in the thread

Any samples would be greatly appreciated

Re: Passing parameters in front-end Allan Mitchell
4/27/2004 3:36:30 PM
Seeing as you are using a Front End application you can change parts of the
package inside using the DTS object model itself providing there is either
no password associated with the package OR you know the owner password.

Execute a package from Visual Basic (VB)
(http://www.sqldts.com/default.aspx?208)

Another way would be to have the DTS package read the values it requires
from a table in a database and then your front end app changes the values in
the database itself. This does of course raise issues in a multi user
environment with people changes the values all the time.


--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]
packages, which are executed one from another. I am now preparing a frontend
for the users to run the packages for themselves. I found examples on how to
do that, but what I need to do is make the users pass parameters to the
executed package. I also now how to do that from within the enterprise
manager. What I'm a little fuzzy about is how to combine those two examples
I found; that is, how to pass the entered parameters in the code of the
frontend and start the package at the same time?
[quoted text, click to view]
I want is to pass the parameters AND execute the first package, which will
then execute the rest - as there are no more parameters to pass or obtain
later on in the thread.
[quoted text, click to view]

Re: Passing parameters in front-end Kaspian
4/28/2004 5:01:11 AM
Thanks Alan for Your prompt reply

As a matter of fact, I already succeded in executing my first package from within an application (.net windows form, visual basic), after reading the article from You and other articles.(Thank You!
It is the parameters which bother me. I am using this code (there are no security issues, the package runs fine without parameters

Sub btn_run_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_run.Clic
Dim pkg As DTS.Package
Dim objGlobal1 As DTS.GlobalVariabl

Tr
pkg = New DTS.Package2(

pkg.LoadFromSQLServer("servername", "username", "password", DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "", "packagename", Nothing
For Each objGlobal1 In pkg.GlobalVariable
MessageBox.Show(objGlobal1.Name
If objGlobal1.Name = "Date1" The
objGlobal1.Value = txtdate.Tex
objGlobal1.Value = DateTime.ToString(objGlobal1
MessageBox.Show(objGlobal1.Value
ElseIf objGlobal1.Name = "Date2" The
objGlobal1.Value = txtdate2.Tex
objGlobal1.Value = DateTime.ToString(objGlobal1
MessageBox.Show(objGlobal1.Value
End I
Nex
pkg.Execute(
pkg.UnInitialize(
pkg = Nothin

Catch exc As System.Runtime.InteropServices.COMExceptio
MessageBox.Show(exc.Message
Catch exc As Exceptio
MessageBox.Show(exc.Message

End Tr
End Su

As I mentioned, I have no problems whatsoever with executing the package per se from this code. It is when I introduce the global variables that I receive a package execution error. The global variables are declared and mapped to the parameters in the sql string that retrieves the data from our oracle database
I constantly get the message: "Parameter is incorrect" within a package execution log
When I insert the two values I am trying to pass as paramters directly into the select statement of the data pump task, the package executes beautifully
I suppose there is a problem with the format of the values I want to pass as parameters. I just do not know where else to look - what else can go wrong with passing parameters
Do You have any idea where I should look

Kind regards

Re: Passing parameters in front-end Allan Mitchell
4/29/2004 7:21:09 AM
Because you are passing values to Global Variables I would check that the
DataType supports the values you are passing.

Also. Why bother with Global Variable values when you can change whatever
you want iside the package through code anyway and as you say the package
executes fine if you directly pass the values to the statements.?



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]
within an application (.net windows form, visual basic), after reading the
article from You and other articles.(Thank You!)
[quoted text, click to view]
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "", "packagename",
Nothing)
[quoted text, click to view]
per se from this code. It is when I introduce the global variables that I
receive a package execution error. The global variables are declared and
mapped to the parameters in the sql string that retrieves the data from our
oracle database.
[quoted text, click to view]
into the select statement of the data pump task, the package executes
beautifully.
[quoted text, click to view]
as parameters. I just do not know where else to look - what else can go
wrong with passing parameters?
[quoted text, click to view]

AddThis Social Bookmark Button