We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Help creating RecurrencePattern from database

I am trying to store a string (or two if necessary) to indicate the recurrence pattern of a "location" task.

Here is the dataset:

[iLocationID]
7

[sRecurrenceStart]
DTSTART;TZID=US-Eastern:20061002T000000

[sRecurrencePattern]
RULE:FREQ=WEEKLY;COUNT=10;INTERVAL=1;BYDAY=MO;WKST=MO

and here is the source code:

SqlConnection dbCon = new SqlConnection(WebConfigurationManager.ConnectionStrings["dbuniSHRED"].ConnectionString);

dbCon.Open();

SqlCommand sqlCmd = new SqlCommand("usp_locationschedule_GetLocationsForInsert", dbCon);

sqlCmd.CommandType = CommandType.StoredProcedure;

SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd);

DataSet ds = new DataSet();

adapter.Fill(ds);

foreach (DataRow dbRow in ds.Tables[0].Rows)

{

string sStart = dbRow["sRecurrenceStart"].ToString();

string sRecurrence = dbRow["sRecurrencePattern"].ToString();

RecurrencePattern pattern = new RecurrencePattern(sStart + "\n" + sRecurrence);

DateCollection dates = pattern.GenerateOccurrences();

foreach (DateTime d in dates)

{

Response.Write(d);

}

}

The RecurrencePattern(sStart + "\n" + sRecurrence); looks well formed, but dates always comes back with a count of 0. I'm trying to test with Every Monday starting on October 2, 2006 with no end date.

Please help!
Dave

If you are using evaluation version (without a license), the range of generated dates is limited to 2000 I think. This is mentioned in the documentation for GenerateOccurrences I think.