Copy/Clone an Event |
Post Reply |
Author | |
mkhadem
Groupie Joined: 28 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
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
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
mkhadem
Groupie Joined: 28 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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...
|
|
mkhadem
Groupie Joined: 28 July 2008 Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Thanks oleg,
I did it as you said and just assigned my EventId in the Sub for DoCreateEvent.
Thanks for your help.
Mo
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |