C#中用于SSIS的JobSchedular [英] JobSchedular for SSIS in C#
本文介绍了C#中用于SSIS的JobSchedular的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们,
我正在使用Web应用程序来运行"SSIS作业".
Hi friends,
I am using a web application to run the "SSIS Job".
Server sqlServer = new Server(serverConnection);
JobServer sqlAgent = sqlServer.JobServer;
Job sqlJob = sqlAgent.Jobs[JobRun];
JobHistoryFilter jobFilter = new JobHistoryFilter();
jobFilter.JobName = JobRun;
sqlJob.Start();
该代码工作正常.现在,我需要安排特定时间的工作.如何设置特定作业的运行时间.
在此先感谢.
The code is working fine. Now I need to Schedule a job for a particular time. How do I set the time for a particular job to run.
Thanks in advance.
推荐答案
在 ^ ],我发现了以下代码段:
In this MSDN documentation [^], I found the following snippet:
Server srv = new Server("(local)");
Job jb = new Job(srv.JobServer, "Test Job");
jb.Create();
JobSchedule jbsch = new JobSchedule(jb, "Test Job Schedule");
jbsch.FrequencyTypes = FrequencyTypes.Daily;
jbsch.FrequencySubDayTypes = FrequencySubDayTypes.Minute;
jbsch.FrequencySubDayinterval = 30;
Timespan ts1 = new Timespan(9, 0, 0);
Timespan ts2 = new Timespan(17, 0, 0);
jbsch.ActiveStartTimeOfDay = ts1;
jbsch.ActiveEndTimeOfDay = ts2;
jbsch.FequencyInterval = 1;
DateTime d = new DateTime(2004, 1, 1);
jbsch.ActiveStartDate = d;
jbsch.Create();
Console.WriteLine(jb.Schedules.ToString());
这是您要找的东西吗?
干杯
Uwe
Is this, what you are looking for?
Cheers
Uwe
这篇关于C#中用于SSIS的JobSchedular的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文