Data change notification in multi user environment

I am using Codebase as the database engine for a multi user (and single user) Windows application.  In a multi user system,  if two users have a data file open and a change is made by one user, how can I get notify the other running application on the other user's PC that a change has been made to the datafile.  I need this functionality to so that the screen/view can be updated to reflect the changes made by the other user.

ie: Windows explorer automatically updates window contents if an item (directory, shortcut etc..) is added to a directory via Network Neighbourhood  on a remote PC, the Windows Explorer screen will be automatically updated to
show this new item.  This is the functionality I am after.

I have (very) limited multi user programming experience so any help would be greatly appreciated.

LVL 4
WoodsterAsked:
Who is Participating?
 
gmoriakConnect With a Mentor Commented:
You're going to have to "fake it".  You could have a timer execute a simple check to see if data has changed every 30 seconds etc.  If data has changed, you would then refresh all of your data.  You need to keep the check simple and fast and execute it as infrequently as possible so as not to degrade perfarmance.

Any more sophistacated solution would involve creating an n-tier application solution.  The above solution is generally a good enough simulation.  Explorer isn't immediate either, there is a lag between files being updated and view being refreshed.


0
 
WoodsterAuthor Commented:
Is there a method of doing this within a single threaded application.  We use an application framework (not MFC) that doesn't seem to like being used in a a multi threaded environment so I am not sure if this solution is applicable.  

Even if using the method you described, how can I tell if a particular record has changed (relational database) without storing the original copy of the record in memory which could result in a large overhead if there are many records being displayed?

What is an n-tier solution?  Would a client/server type set up resolve this problem?  I have not used a Client/Server set up before so am unsure as to the implications of such a system.
0
 
gmoriakCommented:
Client server generally ignores the problem without too many consequences.  Users don't typically update the same thing and when they do, you can simply display a message saying "Data changed etc."
0
 
WoodsterAuthor Commented:
Sorry for the (exceptionally) late response.  The problem is, if I can't determine that the data has been changed, how can I display a message to inform the user?  Do you have any answers for the other questions in my previous comment?
0
 
gmoriakCommented:
Have a lastMod_date column in your table.  Retrieve it when bringing back data and check to make sure it is the same when updating (put it in your where clause)  If it hasn't changed, you know that nobody has changed your data.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.