Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute process task and passing arguments

Status
Not open for further replies.

claws2rip

Programmer
Dec 14, 2001
80
US
I have a DTS package that runs a Vb.Net executable program. I would like to pass a argument from the DTS package to the Vb.Net app without having to enter the argument in the console manually.

Every time I try to run the DTS package and vb.net app the Console appears and waits for my input. How do pass a argument to the Console automatically without inputting it.

Thank you
 
Know nothing about Vb.Net, but how dts is calling the program, by Execute Process task perhaps? If so, you should put your parameter on the command line. Varying the parameter value in Exec Proc task can be done with Dynamic Properties Task, but I won't dive there now. Are you sure it is not the vb program, that pops up the dialog, no matter what ?

Cheers


[blue]Backup system is as good as the latest recovery[/blue]
 

When I put the parameter on the command line do I need to use a slash or just a space and the parameter ?

 
.Net is causing the console to open, that part is fine
but DTS is causing it to hang when I put a value in the parameter field.
I would like to pass the value 1 to my .Net app but the console hangs. I put the number 1 in the parameter field/section. Is that the correct syntax?

 
how are you executing the .Net App? xp_cmdshell?

how you pass the parameter to the .Net app depends on how the app has been setup to accept parameters. depending on who wrote the app it could accept slash prameters, comma parameters, space parameters or no command line parameters at all.
 
I pass the parameter by entering the value in parameter field/section and the app is being executed by calling the exe file in the win32 field/section in the "execute process task properties".



 
I am not aware of a way to pass a parameter to a "Execute process task" from a part of the DTS via GlobalVariable.

You really need to check with the .NET developer on how the .NET app accepts parameters or if it even does. If you get to a point where you know how it accepts parameters I would suggest creating a stored procedure that builds the command line in a variable then passess it to the xp_cmdshell stored procedure.

If you get to this point and don't know how to set this up post here and I will give you an example.
 

Why would using the xp_cmdshell stored procedure be preferred over the DTS package?
Is it faster, easier to use?
 
No it is not faster nor slower, its just a matter of what you are trying to accomplish.

If you have dynamic parameters then you cannot use the "Execute Process Task" to my knowledge without a little ActiveX scripting to set the parameter value.

In which case passing the parameter values to a stored procedure, building the exe path, building the necessary execution string into a variable to be executed by xp_cmdshell is one way to do it within the DTS package itself.

I like this method because I can place all code in 1 stored procedure which allows me to make changes rather quickly without affecting other pieces of code.

Now if you have static parameters then "Execute Process Task" should work.

In this case it is more up to your scope of knowledge, personal preference, and limits set by the .NET app you are trying to pass data to.

Hope this helps!

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top