Subscription.ScheduleRecurrence Property

Gets or sets the schedule recurrence information.

命名空间: Microsoft.SqlServer.NotificationServices
程序集: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)

语法

声明
Public Property ScheduleRecurrence As String
public string ScheduleRecurrence { get; set; }
public:
virtual property String^ ScheduleRecurrence {
    String^ get () sealed;
    void set (String^ value) sealed;
}
/** @property */
public final String get_ScheduleRecurrence ()

/** @property */
public final void set_ScheduleRecurrence (String value)
public final function get ScheduleRecurrence () : String

public final function set ScheduleRecurrence (value : String)

属性值

A String containing schedule recurrence information.

备注

The ScheduleRecurrence property can be null if the ScheduleStart property is also null; otherwise ScheduleRecurrence must have a specified value. These properties are used together to assign a schedule to a subscription.

The value of the ScheduleRecurrence property must be in ICalendar format and use ICalendar recurrence rule syntax. All alphabetic characters in the ScheduleRecurrence property value must be in upper case.

A subscription with no timed rules (where the HasTimedRule property is false) does not permit values to be specified for the ScheduleStart and ScheduleRecurrence properties.

The ICalendar recurrence options are shown in the following table.

ICalendar Recurrence Options

FREQ=DAILY;

FREQ=WEEKLY;BYDAY=DaysOfWeekList;[BYMONTH=MonthsOfYearList;]

FREQ=MONTHLY;BYMONTHDAY=DaysOfMonthList;[BYMONTH=MonthsOfYearList;]

FREQ=YEARLY;BYMONTHDAY=DayOfMonth;BYMONTH=MonthOfYear;

The options that can be used to specify the schedule are:

  • DaysOfWeekList is [DayOfWeek | DayOfWeek,DaysOfWeekList]

    DayOfWeek is [MO | TU | WE | TH | FR | SA | SU]

  • DaysOfMonthList is [DayOfMonth | DayOfMonth,DaysOfMonthList]

    DayOfMonth is [1 | 2 | 3 | ... | 30 | 31]

  • MonthsOfYearList is [MonthOfYear | MonthOfYear,MonthsOfYearList]

    MonthOfYear is [1 | 2 | 3 | ... | 11 | 12]

For example, a valid ScheduleRecurrence value for recurrences on the first and last three months, for the first, eleventh, and fifteenth days of those months, would be FREQ=MONTHLY;BYMONTHDAY=1,11,15;BYMONTH=1,2,3,10,11,12.

示例

The following examples show how to use the ScheduleRecurrence property to set subscription schedule recurrence information:

' Set the recurrence of the subscription.
testSubscription.ScheduleRecurrence = "FREQ=DAILY"
 
' Set the start date and time of the subscription.
Dim scheduleBuilder As New StringBuilder()
scheduleBuilder.AppendFormat( _
    "TZID={0}:{1}{2}{3}T{4}{5}{6}", "4", _
    DateTime.Now.Year.ToString("D4"), _
    DateTime.Now.Month.ToString("D2"), _
    DateTime.Now.Day.ToString("D2"), _
    DateTime.Now.Hour.ToString("D2"), _
    DateTime.Now.Minute.ToString("D2"), _
    DateTime.Now.Second.ToString("D2"))
testSubscription.ScheduleStart = scheduleBuilder.ToString()
// Set the recurrence of the subscription.
testSubscription.ScheduleRecurrence = "FREQ=DAILY";

// Set the start date and time of the subscription.
StringBuilder scheduleBuilder = new StringBuilder();
scheduleBuilder.AppendFormat("TZID={0}:{1}{2}{3}T{4}{5}{6}",
    "4",
    DateTime.Now.Year.ToString("D4"),
    DateTime.Now.Month.ToString("D2"),
    DateTime.Now.Day.ToString("D2"),
    DateTime.Now.Hour.ToString("D2"),
    DateTime.Now.Minute.ToString("D2"),
    DateTime.Now.Second.ToString("D2"));
testSubscription.ScheduleStart = scheduleBuilder.ToString();

线程安全

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

开发平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

目标平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

请参阅

参考

Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace