Solved

How do I execute a DTS package (SQL server 2000) from a client PC using C#?

Posted on 2009-04-03
7
682 Views
Last Modified: 2013-11-30
Hi

I have to make a small application, which will execute a DTS Package on a specific SQL Server 2000 server.
I'm using Visual Studio 2008 Professional.
The DTS Package is kept in the SQL Server; not in a file.
If it is possible to enumerate all DTS packages found on the server, that would be nice too.
It would be ok, if I can use a stored procedure to execute it,

I've been looking all over the internet (well, more or less :-)), but I haven't been able to find a solution.

If I use DTSRun (on the server), for some reason, it returns only the column names, when the connection (inside a package) points to "." or "(local)".
0
Comment
Question by:Hynne
7 Comments
 

Author Comment

by:Hynne
ID: 24060866
Hmm... I have now solved it, using a stored procedure, but I would still like to know if it's possible from C# directly.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24065786
SMO is a good choice for a lot of SQL Server administrative tasks.  I have some code somewhere, that I might be able to find, which runs DTS packages from C#.
0
 

Author Comment

by:Hynne
ID: 24066440
Hi TheLearnedOne
I would love to see it, but don't spend hours finding it, since I believe I can make my stored proc work. (I still need to find a way to enumerate the packages (and version?).
Thanks

 - Hynne
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 24068628
0
 
LVL 22

Expert Comment

by:8080_Diver
ID: 24069386
There is a tool that comes with DTS and SQL Server 2000 that lets you select a DTS package, add the parameters that you want to use when it executes (e.g. username and password), encrypt it.  All you have to do is save that encrypted command string to either a batch file or someplace handy so that you can use it to shell out and execute the command string.  Don't have the tools to walk through to give you detailed instructions at this moment, though.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 24069527
It is called DTSRunUI and the encryption is optional and I would not recommend it.  However I would expect that the author would want to have something a tad more integrated than just shelling out to a command line tool.
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 24073490
If you are using xp_cmdshell to run your DTS package, you should be aware that this can be a security risk if not implemented properly.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Mirror and Replication 5 18
cs.Designer Issue 2 20
Calling stored proc in EDMX 11 19
SQL Split character from numbers 3 18
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now