Monday, March 26, 2012

Running a DTS Package from vb.net

Can anyone point me to some sample code ord give me an example. I'm trying to run a DTS package from my asp.net/vb.net application. I don't need to pass it any variable, just need it to run. I can't seem to find anything on the net for this.
Thanks in advance,
Ryan

There are two ways to do it, through VB.NET code, or through a stored procedure using master..xp_cmdshell. Here's one:

http://www.realworldasp.net/article.asp?article=61
http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic7332.aspx

|||

bmains wrote:


There are two ways to do it, through VB.NET code, or through a stored procedure using master..xp_cmdshell. Here's one:

http://www.realworldasp.net/article.asp?article=61
http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic7332.aspx


The links you provided are not working solutions because the creators have not addressed the SQL Server Agent permissions needed to run DTS with dtsrun.exe and xp_cmdshell.
To run DTS package through a stored proc you either use DTSRUN.exe or XP_CMDSHELL which is SQL Server Agent dependent. Try the links below for DTSRUN.exe sample code and XP_CMDSHELL configurations with permissions. What I am saying is to run DTS with SQL Server Agent dependent service like xp_CMDSHELL you must give the account used to install SQL Server Agent Admin permissions in Windows and SQL Server. Hope this helps.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_xp_aa-sz_8sdm.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_xp_aa-sz_4jxo.asp

http://www.sqlteam.com/item.asp?ItemID=19595

|||This seems way too complicated. Isn't there simple code I can use to create a stored procedue that calls a dts package. Then I can just execute the stored procedure from my asp page. I'm just looking for some sample T-SQL code that executes a DTS Package.
like this. spexecuteDTSPackage('mypackage')
This would be wonderful.|||I don't know of an easier way because it is SQL Server Agent that runs your DTS package through xp_cmdshell.|||That is the DTSrun utility, which in a stored procedure, you have to use master..xp_cmdShell, and get the rights to do so. See, to run it, it needs to know what server to run it on, what is the name, what are the parameters being passed into it (which is cool because you can dynamically assign the server variables in the package with values passed into the stored procedure), what is the package password if there is one|||

I finally got it working. I think I'm going to write a tutorial since there aren't any good ones out there.

I generated the code for the dtsrun.exe with the dtsgui tool then created a stored procedure.

Thanks for all your help.

|||

You ever write a tutorial for this? I have the same problem and need major help getting a dts to run from .net.

Cordell

No comments:

Post a Comment