SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 execute SSIS package with dtexec utility
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sanghavi17389
Starting Member

India
26 Posts

Posted - 01/17/2013 :  08:12:04  Show Profile  Reply with Quote
Hi,

I have made web application and wcf service.
from web api, user can select csv file and in wcf service i want to do code for execute the package.

can anyone suggest me code for executing package using dtexec.exe in command line?

if I write "C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtexec.exe" /F "D:\CloudAmber\Icarus\CloudAmber.DataWarehouse\Harshal\testRecordCount\testRecordCount\Package.dtsx" in command prompt then it works.

but how to pass it to command prompt from c# code?


harshal sanghavi

James K
Flowing Fount of Yak Knowledge

3334 Posts

Posted - 01/17/2013 :  08:50:38  Show Profile  Reply with Quote
Normally one should be able to use the Process class in the System.Diagnostics namespace. The Process.Start method is overloaded with a number of paramters - there is a decent tutorial here: http://www.dotnetperls.com/process-start However, I didn't quite understand your architecture, so if you are unable to invoke Process class on the host system this may not work for you.

There is also a Package class. What you want to look for are Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage and Package.execute.
Go to Top of Page

sanghavi17389
Starting Member

India
26 Posts

Posted - 01/17/2013 :  09:03:57  Show Profile  Reply with Quote
I already tried with that.
I passed the command which I mentioned above in process.start but it does not work.
Let me know that is there any way by which I can execute above command in command prompt?
quote:
Originally posted by James K

Normally one should be able to use the Process class in the System.Diagnostics namespace. The Process.Start method is overloaded with a number of paramters - there is a decent tutorial here: http://www.dotnetperls.com/process-start However, I didn't quite understand your architecture, so if you are unable to invoke Process class on the host system this may not work for you.

There is also a Package class. What you want to look for are Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage and Package.execute.



harshal sanghavi
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3334 Posts

Posted - 01/17/2013 :  09:11:32  Show Profile  Reply with Quote
The other option that I can think of is what I had mentioned about the Package class. At the bare minimum, you would load the package using Application.LoadPackage and then run that package using the Execute method of the Package class.

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.application.loadpackage.aspx
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.execute.aspx

Are you able to do anything at all - even simple commands - using the Process.Start method, or is it that the dtexec is failing?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000