Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Execute DTS Job From Web Page - ASP / ASP.NET

Author  Topic 

besadmin
Posting Yak Master

116 Posts

Posted - 2008-11-13 : 09:46:16
Hey Friends,

I have been assigned the task of writing the code to execute a DTS job that has already been created.

Is this the right place to ask that question?

Any help is greatly appreciated.

ASP is ok, ASP.NET would be best if possible.

Thanks a lot for any responses!!

Ohmslaw
Starting Member

11 Posts

Posted - 2008-11-13 : 11:07:28
Running a DTS package requires you to execute DTSRun.exe on the sql server. So you might want to create a stored procedure on sever that will execute the package for you.

exec master.dbo.xp_cmdshell 'dtsrun.exe -commandlines'

Hope that helps.

Ohms...
Go to Top of Page

besadmin
Posting Yak Master

116 Posts

Posted - 2008-11-13 : 11:15:11
Yes i was told that was an option.
Do you know of any sites or info that would help me with calling the SP from a webpage when click 'Submit'
I would like to use ASP.NET rather than Classic ASP, that should be alright correct?
Thanks for the info Ohms!
Later,
-S
Go to Top of Page

Ohmslaw
Starting Member

11 Posts

Posted - 2008-11-13 : 12:08:13
If you created the stored procedure.

SqlConnection conn = new SqlConnection("connectionString");
conn.Open();
SqlCommand cmd = new SqlCommand(
"sqlStoredProcedureName",
conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
conn.Close();

These objects can be found in System.Data.SqlClient namespace


Ohms...
Go to Top of Page

besadmin
Posting Yak Master

116 Posts

Posted - 2008-11-13 : 12:11:13
Cool, Thanks!
That is in asp.net correct?
I will let you know how it goes once i try it.
Thanks again!
Go to Top of Page

Ohmslaw
Starting Member

11 Posts

Posted - 2008-11-13 : 12:25:23
I don't know how you connect to the SQL server, but if you are using SQL Authentication you may need to add:
EXEC master.dbo.xp_sqlagent_proxy_account N'SET',
N'Domain',
N'UserName',
N'password'

before the xp_cmdshell statment in the stored procedure.

The SQL account will not have the permissions.

Ohms...
Go to Top of Page

besadmin
Posting Yak Master

116 Posts

Posted - 2008-11-13 : 12:48:01
ah ok thanks!
Go to Top of Page

besadmin
Posting Yak Master

116 Posts

Posted - 2008-12-03 : 16:48:33
Hey friends, I am still needed some help with this issue.
I do not want to use the cmd shell or dtsrun.exe
I know it is possible to run a dts from VBscript using ASP from a webpage. if anyone knows how to do this using asp.net i would rather, but i have not seen that before.
there are just no really good examples on doing this through the vbscript asp.
if anyone has any ideas please share with me!!
Thanks a lot guys!
Go to Top of Page
   

- Advertisement -