Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Copy/Clone an Event
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Copy/Clone an Event

 Post Reply Post Reply
Author
Message
mkhadem View Drop Down
Groupie
Groupie


Joined: 28 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mkhadem Quote  Post ReplyReply Direct Link To This Post Topic: Copy/Clone an Event
    Posted: 01 August 2008 at 12:28pm
Hi,
I have issue to clone an event without setting the event id.
If I use CloneEvent or set my new event to the one which I want to copy it copies the eventID too and I can not save it as a new event and get the DB error:
Cannot CreateEvent in DB: ORA-00001: unique constraint (SYSTEM.PK_CALENDAR_EVENTS) violated
 
Dim CopiedEvent As CalendarEvent
 
' Here I want to keep the new created EventId
Set CopiedEvent = CalendarControl.DataProvider.CreateEvent
 
'Here the new event id is changed to the original event id
Set CopiedEvent = OriginalEvent.CloneEvent
 
Any clue?
 
Thanks
Mo
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2008 at 4:31am
Hello,
 
What DataProvider do you use? I tried with our sample use Access mdb file and added this code:
 
 Dim Ev As CalendarEvent, E As CalendarEvent
    Set Ev = CalendarControl.DataProvider.GetEvent(1)
   
    Set E = Ev.CloneEvent()
   
    CalendarControl.DataProvider.AddEvent E
Works fine - DataProvider automatically generated new EventId in AddEvent  method.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
mkhadem View Drop Down
Groupie
Groupie


Joined: 28 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mkhadem Quote  Post ReplyReply Direct Link To This Post Posted: 08 August 2008 at 2:43pm

Hi,

I am using ORACLE and the event ID is not set automatically. I use oracle sequence to get the next valid ID.
 
Here is the workaround but I don't like it. I have to set all event parameters manually to be able to assign my new event ID.
Do you have a better solution?
 
Regards
Mo
 
' Get new ID
 nEventID = m_pDB.DoGetNextUniqueID
 
' Set my event
Set pEvent = m_pCalendar.DataProvider.CreateEventEx(nEventID)
 
pEvent.MeetingFlag = IIf(pEventRS("IsMeeting") <> 0, True, False)
pEvent.PrivateFlag = IIf(pEventRS("IsPrivate") <> 0, True, False)
pEvent.Label = pEventRS("LabelID")
 
and so on...
Back to Top
mkhadem View Drop Down
Groupie
Groupie


Joined: 28 July 2008
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote mkhadem Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2008 at 4:34pm
Thanks oleg,
I did it as you said and just assigned my EventId in the Sub for DoCreateEvent.
 
Thanks for your help.
Mo
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.143 seconds.