dbTalk Databases Forums  

Passing parameters in front-end

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


Discuss Passing parameters in front-end in the microsoft.public.sqlserver.dts forum.



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

Default Passing parameters in front-end - 04-27-2004 , 01:31 AM






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

Kaspian

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

Default Re: Passing parameters in front-end - 04-27-2004 , 09:36 AM






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


"Kaspian" <alipow (AT) nospam_wp (DOT) pl> wrote

Quote:
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?
Quote:
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.
Quote:
Any samples would be greatly appreciated!

Kaspian



Reply With Quote
  #3  
Old   
Kaspian
 
Posts: n/a

Default Re: Passing parameters in front-end - 04-28-2004 , 07:01 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

Kaspian

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

Default Re: Passing parameters in front-end - 04-29-2004 , 01:21 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


"Kaspian" <alipow (AT) nospam_wp (DOT) pl> wrote

Quote:
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!)
Quote:
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.Click
Dim pkg As DTS.Package2
Dim objGlobal1 As DTS.GlobalVariable

Try
pkg = New DTS.Package2()

pkg.LoadFromSQLServer("servername", "username", "password",
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, "", "", "", "packagename",
Nothing)
Quote:
For Each objGlobal1 In pkg.GlobalVariables
MessageBox.Show(objGlobal1.Name)
If objGlobal1.Name = "Date1" Then
objGlobal1.Value = txtdate.Text
objGlobal1.Value = DateTime.ToString(objGlobal1)
MessageBox.Show(objGlobal1.Value)
ElseIf objGlobal1.Name = "Date2" Then
objGlobal1.Value = txtdate2.Text
objGlobal1.Value = DateTime.ToString(objGlobal1)
MessageBox.Show(objGlobal1.Value)
End If
Next
pkg.Execute()
pkg.UnInitialize()
pkg = Nothing

Catch exc As System.Runtime.InteropServices.COMException
MessageBox.Show(exc.Message)
Catch exc As Exception
MessageBox.Show(exc.Message)

End Try
End Sub


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.
Quote:
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.
Quote:
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?
Quote:
Do You have any idea where I should look?

Kind regards,

Kaspian



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.