Best method ? Multi-USER / Multi-Resource |
Post Reply |
Author | |
vbuser
Newbie Joined: 22 January 2004 Status: Offline Points: 39 |
Post Options
Thanks(0)
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 Access, multi-resources and Re-occurence together... Any help will really be appreciated. Thank you!
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
vbuser
Newbie Joined: 22 January 2004 Status: Offline Points: 39 |
Post Options
Thanks(0)
|
Do you have a sample using Access in CUSTOM mode? Perhaps an access implementation of the 'providerSQLServer" class?
thank you!
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
vbuser
Newbie Joined: 22 January 2004 Status: Offline Points: 39 |
Post Options
Thanks(0)
|
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!
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
1. Call Populate method:
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 |
|
vbuser
Newbie Joined: 22 January 2004 Status: Offline Points: 39 |
Post Options
Thanks(0)
|
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.
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
gaudetm
Senior Member Joined: 23 September 2006 Location: Canada Status: Offline Points: 134 |
Post Options
Thanks(0)
|
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
|
|
vbuser
Newbie Joined: 22 January 2004 Status: Offline Points: 39 |
Post Options
Thanks(0)
|
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!
|
|
vbuser
Newbie Joined: 22 January 2004 Status: Offline Points: 39 |
Post Options
Thanks(0)
|
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...
|
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
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 |
|
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 |