Print Page | Close Window

Multiple Schedule

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=6322
Printed Date: 07 October 2024 at 1:17am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Multiple Schedule
Posted By: haitaowu
Subject: Multiple Schedule
Date Posted: 05 February 2007 at 12:04pm
Hi,
 
  I have a issue with Multiple Schedule. I am using Access 2003. I got multiple schedule shown in calendar, but no events shown. The code is shown below:
 
Private Sub Form_Load()
    Dim arResources As New CalendarResources
    Dim pRes0 As New CalendarResource
    Dim pRes1 As New CalendarResource
    Dim NewEvent As CalendarEvent
    pRes0.SetDataProvider CalendarControl.DataProvider, False
    pRes1.SetDataProvider CalendarControl.DataProvider, False
 
    Dim pSchedules As CalendarSchedules
    Set pSchedules = pRes0.DataProvider.Schedules
    If pSchedules Is Nothing Then
        Exit Sub
    End If
    If pSchedules.Count < 1 Then
        pSchedules.AddNewSchedule "John"
        pSchedules.AddNewSchedule "Terry"
        pRes0.DataProvider.Save
    End If
   
    pRes0.Name = pSchedules.Item(0).Name
    pRes0.ScheduleIDs.Add pSchedules.Item(0).Id
       
    pRes1.Name = pSchedules.Item(1).Name
    pRes1.ScheduleIDs.Add pSchedules.Item(1).Id
   
    Set NewEvent = pRes0.DataProvider.CreateEvent
    NewEvent.Subject = "test"
    NewEvent.Location = "test"
    NewEvent.StartTime = Now
    NewEvent.ScheduleID = pSchedules.Item(0).Id
    pRes0.DataProvider.AddEvent NewEvent
    pRes0.DataProvider.Save
       
    arResources.Add pRes0
    arResources.Add pRes1
    CalendarControl.SetMultipleResources arResources
    CalendarControl.Populate
End Sub
 
Thanks for any help!



Replies:
Posted By: sserge
Date Posted: 07 February 2007 at 3:14pm
Hi,

The following is not a good way to operate:

pRes0.SetDataProvider CalendarControl.DataProvider, False
pRes1.SetDataProvider CalendarControl.DataProvider, False


The reason is that CalendarControl.DataProvider is equal to CalendarControl.Resources(0).DataProvider in a multi-resources mode.

Instead, it would be better to write:

pRes0.SetDataProvider2 "connection string", True 
pRes1.SetDataProvider pRes0.DataProvider, False


--
WBR,
Serge


Posted By: haitaowu
Date Posted: 07 February 2007 at 3:44pm
Thanks for the response.
 
We prefer not to set connection string for the calendar dataprovider. Instead, we are going to get a recordset from sql server databbase, then create events and populate calendar. We are able to get it work in single resource calendar. We are having trouble in multi-resource mode.
 
Thanks for any advice.


Posted By: sserge
Date Posted: 07 February 2007 at 4:57pm
In this case you can simply skip setting connection string, because the first data provider is created of Memory type by default.

--
WBR,
Serge


Posted By: RogerHitz
Date Posted: 28 January 2009 at 10:15am
Hello

I am new to Codejock Calendar Pro

I have a issue with Multiple Schedule.

I don't want to set connection string for the calendar dataprovider. Instead, I will get a recordset from sql server databbase, then create events and populate calendar.

I am able to get it work in single resource calendar. But I am having trouble in multi-resource mode

How do I skip connection string and create a Memory type ?
Can you send me an VB example ?

THanks

ROGER



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net