Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Best  method ? Multi-USER / Multi-Resource
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Best method ? Multi-USER / Multi-Resource

 Post Reply Post Reply
Author
Message
vbuser View Drop Down
Newbie
Newbie


Joined: 22 January 2004
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote vbuser Quote  Post ReplyReply Direct Link To This Post Topic: Best method ? Multi-USER / Multi-Resource
    Posted: 15 October 2006 at 2:09pm

I'm confused about the best method to use when working with an Access Database in a multi-user enviroment using VB6. The small article in your web indicates that for multi-user enviroments the CUSTOM data provider should be used, and to look at the class 'providerSQLServer' for examples.

So is it safe to assume that the built-in data providers SHOULD NEVER be used in multi-user enviroment? 
 
I've read the article, and looked at various topics here, but I cant seem to put all these IDEAS together, the  'providerSQLServer" using Accessmulti-resources and Re-occurence together... Any help will really be appreciated.   Thank you!
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2006 at 2:58pm
Originally posted by vbuser vbuser wrote:

So is it safe to assume that the built-in data providers SHOULD NEVER be used in multi-user enviroment? 


No, you still can use Access or any built-in dataprovider in multi-user environment, but... The problem is in having proper synchronization between those multi-users.

Example: you can have a common network share where your Access database will be stored. Applications from different workstations will connect to this database -- no problem. Users will see all appointments stored there.

But when someone add or change or delete an appointment -- how others will know about that?..

So, you'll have to have some specific engine of notifying clients each other when some data has been changed, and the best place to implement this engine is custom data provider.


BTW, you can simply reload events for every user by timer for every 10 seconds for example, but of course this is not a very good solution...

--
WBR,
Serge
Back to Top
vbuser View Drop Down
Newbie
Newbie


Joined: 22 January 2004
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote vbuser Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2006 at 10:30am
Do you have a sample using Access in CUSTOM mode? Perhaps an access implementation of the 'providerSQLServer" class?
thank you!
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2006 at 12:09pm
No we have only built-in Access data provider.
Try to use SQL Server custom data provider sample to create the same one for Access...

--
WBR,
Serge
Back to Top
vbuser View Drop Down
Newbie
Newbie


Joined: 22 January 2004
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote vbuser Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2006 at 3:37am
I converted the providerSQLServer to use Access in CUSTOM mode, so I can handle all the DoXX events for Multi-User enviroments.
I CANNOT figure out how to set up multi-resources, how do I populate  pRes0.SetDataProvider2 ? This is what I got from teh sample:
Dim arResources As New CalendarResources
    Dim pRes0 As New CalendarResource
    Dim pRes1 As New CalendarResource
   
    pRes0.SetDataProvider2 ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\events.mdb", True
     
    If pRes0.DataProvider Is Nothing Then
        Debug.Assert False
        Exit Sub
    End If
   
    If Not pRes0.DataProvider.Open Then
        If Not pRes0.DataProvider.Create Then
            Debug.Assert False
            Exit Sub
        End If
    End If
   
    '// ** schedules
    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 "Tech 1"
        pSchedules.AddNewSchedule "Tech 2"
        pRes0.DataProvider.Save
    End If
   
    '// ** resources
   
    pRes0.Name = pSchedules.Item(0).Name
    pRes0.ScheduleIDs.Add pSchedules.Item(0).Id
   
    pRes1.SetDataProvider pRes0.DataProvider, False
    pRes1.Name = pSchedules.Item(1).Name
    pRes1.ScheduleIDs.Add pSchedules.Item(1).Id
   
   
    arResources.Add pRes0
    arResources.Add pRes1
      
    CalendarControl.SetMultipleResources arResources
 
The problem here is that when I do this the Calendar control switches back to the internal access data provider and no longer calls the DoXX events... What did I miss?
 
Also, I need a SCROLL BAR at the buttom of the scheduler because I need to have MANY resources, about 17, in day view, and the scheduler cannot fit them properly - how can I implement this? Thank yoU!   
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 17 October 2006 at 7:51am
1. Call Populate method:

CalendarControl.SetMultipleResources
CalendarControl. Populate

2. Calendar Event has ScheduleID field and property.
Ensure that events in you table have ScheduleIDs corresponding
other ScheduleIDs which you setup in data provider Schedules member.

--
WBR,
Serge
Back to Top
vbuser View Drop Down
Newbie
Newbie


Joined: 22 January 2004
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote vbuser Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 2:55am
Yeah, I had left those 2 lines - I think the trick was to make sure the pRes0.SetDataProvider2 has 'Provider=custom. Thank you
 
QUESTION: How can I add a horizontal scroll to the control?
I need this because I have to show many resources.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 3:36am
Originally posted by vbuser vbuser wrote:

 
QUESTION: How can I add a horizontal scroll to the control?
I need this because I have to show many resources.


This is not possible. See also http://forum.codejock.com/forum_posts.asp?TID=3664

Try to think about some workaround like show only 1 day in DayView, or change resource configuration on the fly (after switching a day, or with some additional chackboxes available for a user, and so on)

--
WBR,
Serge
Back to Top
gaudetm View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 September 2006
Location: Canada
Status: Offline
Points: 134
Post Options Post Options   Thanks (0) Thanks(0)   Quote gaudetm Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 10:21am
My solution for multiusers synchronisation is simple, implent a new table in the database call Updates in that table add fields documenttype and lastupdate (time and date) and put a timer on my main form and check updates every 2 secondes and update only is lastdate > date in table updates so that way only update when someone do a change and when someone add, delete or modify a record on the save function just update the table updates
 
Hope this help, It's as far as I know the best solution yet, dont take so many time consuming besause of a good sql query and timers in vb6 are in a separated thread so don't freeze the application
 
Marc
 
Back to Top
vbuser View Drop Down
Newbie
Newbie


Joined: 22 January 2004
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote vbuser Quote  Post ReplyReply Direct Link To This Post Posted: 18 October 2006 at 7:51pm
Too bad about the scroll bar, I will think of a solution...
 
@gaudetm,
thanks for your great input - I was inclined to do something like that, and may be add code to avoid updating the calendar if user is editing an event, etc. Thanks again!
Back to Top
vbuser View Drop Down
Newbie
Newbie


Joined: 22 January 2004
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote vbuser Quote  Post ReplyReply Direct Link To This Post Posted: 21 October 2006 at 11:39am
When I set the pRes0.SetDataProvider2  = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\events.mdb", True everything runs file, the Schedules table is accessed, resource names are read, etc. When I set  pRes0.SetDataProvider2 = "Provider=custom", True, the table is no longer read, where are do I process the table events? How do I access or set database events for the resources? In my application the resources names are to be read from an EMPLOYEES table, not the default 'Schedules' table. Also, how do I save the OPTIONS when in 'custom' mode?
I have tried different ways to make this work and I need help please...
 
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 21 October 2006 at 6:28pm
If you set sonnection string "provider=Custom" the custom data provider is created. In this case calendar sends DoXXX events, which you have to catch and process like in our example (connect DB by yourself using ADO or somthing other, write SQL to read from DB and Update DB, etc)
 
If you set sonnection string "Provider=Microsoft.Jet.OLEDB.4.0; ..." the built-in Access data provider is created, which connects to DB and processes requests inside. DoXXX events are not sent in this case. This provider works with predefined tables.
 
You can use any of those providers.
 
Custom provider:
    Advantage:     flexibility. Everything is in your hands.
    Disadvantage:  it is complex to implement.
 
Built-In Access data provider:
    Advantage:     it is easy to use.
    Disadvantage:  it use some predefined tables, and not so flexibile.
 
In any case you can read Options and Schedules after you Open data provider. Just read data from DB and put it to CalendarControl.Option and CalendarDataProvider.Schedules objects.
 
When you call CalendarDataProvider.Open (or Create) those members are filled with default values (or empty).
 
And save this data to DB before closing a data provider (custom or access).
 
ps: regarding @gaudetm's advice: you can use notifications EventAdded, EventChanged, EventDeleted to mark that data has been changed. They are sending for any data provider.

--
WBR,
Serge
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.156 seconds.