dbTalk Databases Forums  

Execute SQL Server's DTSRun from c#

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


Discuss Execute SQL Server's DTSRun from c# in the microsoft.public.sqlserver.dts forum.



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

Default Execute SQL Server's DTSRun from c# - 02-02-2004 , 06:08 AM






I am trying to run a DTS package using C#. When I try to execute DTSRun it
runs hidden, I do not see the command window anywhere.

Here is my code:


System.Diagnostics.ProcessStartInfo info = new
System.Diagnostics.ProcessStartInfo();

//set up processstartinfo
info.FileName = "DTSRun";
info.Arguments = server.ExeSyntax; //This holds the syntax
info.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
System.Diagnostics.Process.Start(info);

Is there anything else that I need to do?

Thanks

Dan



---
Posted using Wimdows.net NntpNews Component - Posted from SQL Servers Largest Community Website: http://www.sqlJunkies.com/newsgroups/

Reply With Quote
  #2  
Old   
Russel Loski
 
Posts: n/a

Default RE: Execute SQL Server's DTSRun from c# - 02-02-2004 , 01:46 PM






I may be wrong, but I don't think that DTSRun provides a GUI at all. I think that the status box comes with the enterprise manager.

Russel Loski, MCSD

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

Default re: RE: Execute SQL Server - 02-02-2004 , 01:55 PM



It doesn't come up with a UI but it the command promt does come up.

---
Posted using Wimdows.net NntpNews Component - Posted from SQL Servers Largest Community Website: http://www.sqlJunkies.com/newsgroups/

Reply With Quote
  #4  
Old   
Russel Loski
 
Posts: n/a

Default RE: Execute SQL Server - 02-02-2004 , 08:26 PM



Check this URL out
http://radio.weblogs.com/0111551/sto...ItsOutput.html

This shows how to run a process and get the standard output. You could just as easily get the standard output and shove it to a windows form if you like.

Russ

Here is the code I altered to run a dts package.

using System;

using System.Diagnostics;

namespace ConsoleApplication8

{


class Class1

{

static void Main(string[] args)

{

ProcessStartInfo proc = new ProcessStartInfo(); /* a process holder */

proc.FileName = "dtsrun.exe";

proc.RedirectStandardInput = false;

proc.RedirectStandardOutput = true;

proc.Arguments = "/SLOSKICON /E /N\"New Package\"";

proc.UseShellExecute = false; /*do not show console for the process - a must*/

Process p = Process.Start(proc);

string res;

res = p.StandardOutput.ReadToEnd();

System.Console.WriteLine(res);

p.WaitForExit(); /*wait indefinitely for the associated process to exit*/

}


}

}

Reply With Quote
  #5  
Old   
danielreber
 
Posts: n/a

Default re: RE: Execute SQL Server - 02-04-2004 , 08:29 AM



Thanks for the info. I figured it out yesterday. It was because I was starting dtsrun from a windoes service and I didn't check the "Interact with desktop" option. Once that was checked then the window opened

Dan

---
Posted using Wimdows.net NntpNews Component - Posted from SQL Servers Largest Community Website: http://www.sqlJunkies.com/newsgroups/

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.