473,779 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Automatically Update UI When Data Changes

Here's one that should probably have the sub-heading "I'm sure I asked this
once before, but ...".

Two users are both looking at the same data, from a database. One user
changes the data and commits it. How does the other user get the updated
view without polling for changes? Is there some sort of callback mechanism
that can be set up on the dataset or connection?

TIA

Charles
Jun 7 '06
32 2006
RMT

I am currently implementing a pattern that allows this to happen. It is
actually a non-trivial problem. My pattern uses a worker thread for
performing operations, I have my own data cache, ie. I don't use data sets.
The thread checks the cache in idle time to see if anything has changed and
fires off Update, Delete, Insert and Move (it's a tree structure so I need
this one) methods to it's listeners. UI components (user controls) register
with the data cache as listeners for these kind of events and implement an
IDataUpdateThre adNotification interface. In actuality, there are over 60
different kinds of event. Note that the worker thread does not directly
alter the cache, it only reads it, fetches any relevant data and then
invokes a method on the cache object to resolve any changes that were
detected.

For example, consider I have a set of records in an array, stored in my
cache. The process would look like this:

(1) Thread is idling, so it decides to do a "coherency check"
(2) Thread creates a data connection and fetches the records
(3) Thread Invokes a method on the cache called "RecordsFetched "
....
(4) Cache compares all of the time stamps in the fetched records with the
current records and:

Any timestamps that are different, fires an Updated event to it's
listeners
Any records that exist in the fetched set but not in the cache, fires an
Inserted event to it's listeners
Any records that exist in the cache by not in the fetched set, fires a
Deleted event to it's listeners
Anyway, this is the basis I am working from with all of my (somewhat
complex) data structures. Perhaps it's easier with a single data set. I
would definatley avoid any server event notification systems - it's too easy
for your client to miss a message and thereby mess up your state.


"Charles Law" <bl***@nowhere. com> wrote in message
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
Here's one that should probably have the sub-heading "I'm sure I asked
this once before, but ...".

Two users are both looking at the same data, from a database. One user
changes the data and commits it. How does the other user get the updated
view without polling for changes? Is there some sort of callback mechanism
that can be set up on the dataset or connection?

TIA

Charles

Jun 7 '06 #11
Charles

The stock market prices change by the second, and it is important that
traders have up-to-the-second prices on their screens. Polling is very
inefficient. The observer pattern was made for this scenario but I am
hearing that it can't be implemented on a database. I still think that
this _is_ widely wanted, but that we are largely being told that it can't
be done.

I gave an half our ago a message that you have read wherin I wrote that
this are the situations where it is needed complete with a sample from Ken
about that. (Using the notify), I have however the idea that you did not
even look at it.

Therefore why are you writing this while I wrote that already, secondly as
forever did you not give that information in your first message. Not every
application is a broker application you know?

:-)

Cor
Jun 7 '06 #12
Have I upset you in some way Cor?
I gave an half our ago a message that you have read wherin I wrote that
this are the situations where it is needed complete with a sample from
Ken about that. (Using the notify), I have however the idea that you did
not even look at it.
In fact I did, and bookmarked it. That is how I knew that the SqlDependency
class had been introduced in VS2005.
Therefore why are you writing this while I wrote that already, secondly as
forever did you not give that information in your first message. Not every
application is a broker application you know?
Indeed, but why would I be asking about a notify feature if I did not want
it for a good reason?

:-)

Charles
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:e6******** ******@TK2MSFTN GP05.phx.gbl... Charles

The stock market prices change by the second, and it is important that
traders have up-to-the-second prices on their screens. Polling is very
inefficient. The observer pattern was made for this scenario but I am
hearing that it can't be implemented on a database. I still think that
this _is_ widely wanted, but that we are largely being told that it can't
be done.

I gave an half our ago a message that you have read wherin I wrote that
this are the situations where it is needed complete with a sample from
Ken about that. (Using the notify), I have however the idea that you did
not even look at it.

Therefore why are you writing this while I wrote that already, secondly as
forever did you not give that information in your first message. Not every
application is a broker application you know?

:-)

Cor

Jun 7 '06 #13
Hi
My pattern uses a worker thread for performing operations, I have my own
data cache, ie. I don't use data sets. The thread checks the cache in idle
time to see if anything has changed and fires off Update, Delete, Insert
and Move (it's a tree structure so I need this one) methods to it's
listeners. UI components (user controls) register with the data cache as
listeners for these kind of events and implement an
IDataUpdateThre adNotification interface.
I might have a go at this; I take your point about the danger of missing a
server message. Although it shouldn't happen, I have no doubt that it could.

Have you determined a suitable frequency for checking in your worker thread?
Where do you create the data caches, on the UI thread or the worker thread?

Charles
"RMT" <no****@nospam. com> wrote in message
news:e6******** ***********@new s.demon.co.uk.. .
I am currently implementing a pattern that allows this to happen. It is
actually a non-trivial problem. My pattern uses a worker thread for
performing operations, I have my own data cache, ie. I don't use data
sets. The thread checks the cache in idle time to see if anything has
changed and fires off Update, Delete, Insert and Move (it's a tree
structure so I need this one) methods to it's listeners. UI components
(user controls) register with the data cache as listeners for these kind
of events and implement an IDataUpdateThre adNotification interface. In
actuality, there are over 60 different kinds of event. Note that the
worker thread does not directly alter the cache, it only reads it, fetches
any relevant data and then invokes a method on the cache object to resolve
any changes that were detected.

For example, consider I have a set of records in an array, stored in my
cache. The process would look like this:

(1) Thread is idling, so it decides to do a "coherency check"
(2) Thread creates a data connection and fetches the records
(3) Thread Invokes a method on the cache called "RecordsFetched "
...
(4) Cache compares all of the time stamps in the fetched records with the
current records and:

Any timestamps that are different, fires an Updated event to it's
listeners
Any records that exist in the fetched set but not in the cache, fires
an Inserted event to it's listeners
Any records that exist in the cache by not in the fetched set, fires a
Deleted event to it's listeners
Anyway, this is the basis I am working from with all of my (somewhat
complex) data structures. Perhaps it's easier with a single data set. I
would definatley avoid any server event notification systems - it's too
easy for your client to miss a message and thereby mess up your state.


"Charles Law" <bl***@nowhere. com> wrote in message
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
Here's one that should probably have the sub-heading "I'm sure I asked
this once before, but ...".

Two users are both looking at the same data, from a database. One user
changes the data and commits it. How does the other user get the updated
view without polling for changes? Is there some sort of callback
mechanism that can be set up on the dataset or connection?

TIA

Charles


Jun 7 '06 #14
RMT
The data cache is really the central controller of the whole thing, created
on the UI thread. It basically mediates between the UI components and the
worker thread and the worker thread does all the talking to the database.
The thread maintains queues of operations to perform. The data cache adds a
request to the queue when something needs to be done, for example:
User clicks ADD RECORD button on a toolbar
Code behind the toolbar click tells the cache to ADD RECORD
The cache formats a request and queues it at the thread,
theThread.AddRe quest (theRequest, CRITICAL)
....then forgets about it.
I have 3 queues: CRITICAL, UI and BORED. Critical is for performing
operations the user requests, UI is for things like fetching thumbnails (in
my application this is a neccessary evil) and BORED is for coherency
checking and other stuff like that.

On each iteration of the worker thread loop ( while not m_bFinished () ), it
takes the single highest priority item from the list of queues and executes
it. If there is nothing in any of the lists, it idles for 100ms (so it
doesn't take up all CPU) - after idling it will choose something to check
coherency for (in my case the Tree Structure, Thumbnails, etc.) and creates
a request, adding it to the BORED queue. Then:

Thread de-queues the single highest priority request
Executes it
Invokes the result back to the cache
The cache resolves changes and fires events to it's listeners.

In terms of frequency, I leave this up to the user. You have to trade
coherency against network traffic and performance - my application is
designed to be able to connect to a webserver via. SOAP or ASP.NET, so it's
important I can throttle the coherency check down if I need to.

Note that even with high coherency, the user can still execute an action and
have it fail - ie. it's still possible to attempt to modify a record another
user has deleted, if you do it before the coherency check works out that the
record was deleted. To handle this case, you simply tell the user with an
error message, ie. "The record could not be modified because it no longer
exists".
It's really a simple pattern but implementation details can be more tricky.
If you need any help, post up :).

"Charles Law" <bl***@nowhere. com> wrote in message
news:ed******** ******@TK2MSFTN GP05.phx.gbl...
Hi
My pattern uses a worker thread for performing operations, I have my own
data cache, ie. I don't use data sets. The thread checks the cache in
idle time to see if anything has changed and fires off Update, Delete,
Insert and Move (it's a tree structure so I need this one) methods to
it's listeners. UI components (user controls) register with the data
cache as listeners for these kind of events and implement an
IDataUpdateThre adNotification interface.


I might have a go at this; I take your point about the danger of missing a
server message. Although it shouldn't happen, I have no doubt that it
could.

Have you determined a suitable frequency for checking in your worker
thread? Where do you create the data caches, on the UI thread or the
worker thread?

Charles
"RMT" <no****@nospam. com> wrote in message
news:e6******** ***********@new s.demon.co.uk.. .

I am currently implementing a pattern that allows this to happen. It is
actually a non-trivial problem. My pattern uses a worker thread for
performing operations, I have my own data cache, ie. I don't use data
sets. The thread checks the cache in idle time to see if anything has
changed and fires off Update, Delete, Insert and Move (it's a tree
structure so I need this one) methods to it's listeners. UI components
(user controls) register with the data cache as listeners for these kind
of events and implement an IDataUpdateThre adNotification interface. In
actuality, there are over 60 different kinds of event. Note that the
worker thread does not directly alter the cache, it only reads it,
fetches any relevant data and then invokes a method on the cache object
to resolve any changes that were detected.

For example, consider I have a set of records in an array, stored in my
cache. The process would look like this:

(1) Thread is idling, so it decides to do a "coherency check"
(2) Thread creates a data connection and fetches the records
(3) Thread Invokes a method on the cache called "RecordsFetched "
...
(4) Cache compares all of the time stamps in the fetched records with the
current records and:

Any timestamps that are different, fires an Updated event to it's
listeners
Any records that exist in the fetched set but not in the cache, fires
an Inserted event to it's listeners
Any records that exist in the cache by not in the fetched set, fires a
Deleted event to it's listeners
Anyway, this is the basis I am working from with all of my (somewhat
complex) data structures. Perhaps it's easier with a single data set. I
would definatley avoid any server event notification systems - it's too
easy for your client to miss a message and thereby mess up your state.


"Charles Law" <bl***@nowhere. com> wrote in message
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
Here's one that should probably have the sub-heading "I'm sure I asked
this once before, but ...".

Two users are both looking at the same data, from a database. One user
changes the data and commits it. How does the other user get the updated
view without polling for changes? Is there some sort of callback
mechanism that can be set up on the dataset or connection?

TIA

Charles



Jun 7 '06 #15
I'm not really convinced by the bank sample. It could be blocked when the
transaction is actually processed IMO there is no need to see the amount
refreshed in real time. I'm not even sure the idea is not that it will be
blocked soon enough by the following transaction if not by the current
one....

The stock market price is much more convincing (but this is a niche not
something widely wanted). Several options would be :
- polling
- sql dependency
- callback coming from the server (using remoting, web services, broadcast
or multicast message etc)
etc...

What is your specific scenario ?

--
Patrice

"Charles Law" <bl***@nowhere. com> a écrit dans le message de news:
OS************* *@TK2MSFTNGP03. phx.gbl...
Hi Patrice

Thanks for the reply.
... such as plane reservation or something similar ...


That is a good example. Also, a bank call centre. The advisor is referring
to information on-screen whilst discussing details with a caller.
Transactions occur asynchronously, so the account balance could change
whilst the call is in progress. Unless the advisor repeatedly presses an
update button, they would not see the changes.

The stock market prices change by the second, and it is important that
traders have up-to-the-second prices on their screens. Polling is very
inefficient. The observer pattern was made for this scenario but I am
hearing that it can't be implemented on a database. I still think that
this _is_ widely wanted, but that we are largely being told that it can't
be done.

Charles
"Patrice" <sc****@chez.co m> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
AFAIK this is generally not widely wanted (after all if the other user
would have updated few minutes later, the user that is looking the data
would have not seen this change, so the first question is likely is this
that critical to have instant updates or is it enough to just see what is
current when you request for it comapred with the additional
complexity/processing cost ? If you have a special need, such as plane
reservation or something similar you may want to explain what you are
trying to do...).

--
Patrice

"Charles Law" <bl***@nowhere. com> a écrit dans le message de news:
u7************* *@TK2MSFTNGP05. phx.gbl...
Hi Cor

Sorry if I am not catching on very quickly, but I don't quite see how
your scenario would work.

A dataset keeps track of the changed rows as long as you did not do
acceptchanges.

Isn't this the dataset of the user who has made the changes? What about
the dataset of the user who is just viewing the data? Does that get some
notification of the changes as well?

In the update process the code checks first row by row of those
original rows are changed in the database. (Created new, deleted or
updated).

This sounds like something that would happen when the second user tries
to make changes, in which case I agree that there would be some sort of
error because the data had already changed. But suppose the second user
is just looking at the data? Because datasets are disconnected in .NET
it seems to me that the second user might never see the changes unless
he specifically reloads the data.

Charles
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:uu******** ******@TK2MSFTN GP02.phx.gbl...
Charles,

If you are using any kind of dataadapter/tableadapter and
dataset/datatable than it is quiet easy.

A dataset keeps track of the changed rows as long as you did not do
acceptchanges.

In the update process the code checks first row by row of those
original rows are changed in the database. (Created new, deleted or
updated).

If that is the fact than you get a concurrency error.
Be aware that accepted rows are handled, so the recovery process is not
easy.
(Although you can set the connection with a begintransactio n and a
commit or non commit of that).

Because of the fact that this situations in most situations is seldom,
it is called optimistic concurrency.
However you have to check it and creates the procedures.
Even if that is telling setting everything back to the first state and
telling the user to do his job again.

Very simple is it not?

Cor

"Charles Law" <bl***@nowhere. com> schreef in bericht
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
> Here's one that should probably have the sub-heading "I'm sure I asked
> this once before, but ...".
>
> Two users are both looking at the same data, from a database. One user
> changes the data and commits it. How does the other user get the
> updated view without polling for changes? Is there some sort of
> callback mechanism that can be set up on the dataset or connection?
>
> TIA
>
> Charles
>
>



Jun 7 '06 #16
I see what you mean about non-trivial ;-)

I will read and digest. It is the kind of thing that could fit with my
scenario.

Thanks.

Charles
"RMT" <no****@nospam. com> wrote in message
news:e6******** ***********@new s.demon.co.uk.. .
The data cache is really the central controller of the whole thing,
created on the UI thread. It basically mediates between the UI components
and the worker thread and the worker thread does all the talking to the
database. The thread maintains queues of operations to perform. The data
cache adds a request to the queue when something needs to be done, for
example:
User clicks ADD RECORD button on a toolbar
Code behind the toolbar click tells the cache to ADD RECORD
The cache formats a request and queues it at the thread,
theThread.AddRe quest (theRequest, CRITICAL)
...then forgets about it.
I have 3 queues: CRITICAL, UI and BORED. Critical is for performing
operations the user requests, UI is for things like fetching thumbnails
(in my application this is a neccessary evil) and BORED is for coherency
checking and other stuff like that.

On each iteration of the worker thread loop ( while not m_bFinished () ),
it takes the single highest priority item from the list of queues and
executes it. If there is nothing in any of the lists, it idles for 100ms
(so it doesn't take up all CPU) - after idling it will choose something to
check coherency for (in my case the Tree Structure, Thumbnails, etc.) and
creates a request, adding it to the BORED queue. Then:

Thread de-queues the single highest priority request
Executes it
Invokes the result back to the cache
The cache resolves changes and fires events to it's listeners.

In terms of frequency, I leave this up to the user. You have to trade
coherency against network traffic and performance - my application is
designed to be able to connect to a webserver via. SOAP or ASP.NET, so
it's important I can throttle the coherency check down if I need to.

Note that even with high coherency, the user can still execute an action
and have it fail - ie. it's still possible to attempt to modify a record
another user has deleted, if you do it before the coherency check works
out that the record was deleted. To handle this case, you simply tell the
user with an error message, ie. "The record could not be modified because
it no longer exists".
It's really a simple pattern but implementation details can be more
tricky. If you need any help, post up :).

"Charles Law" <bl***@nowhere. com> wrote in message
news:ed******** ******@TK2MSFTN GP05.phx.gbl...
Hi
My pattern uses a worker thread for performing operations, I have my own
data cache, ie. I don't use data sets. The thread checks the cache in
idle time to see if anything has changed and fires off Update, Delete,
Insert and Move (it's a tree structure so I need this one) methods to
it's listeners. UI components (user controls) register with the data
cache as listeners for these kind of events and implement an
IDataUpdateThre adNotification interface.


I might have a go at this; I take your point about the danger of missing
a server message. Although it shouldn't happen, I have no doubt that it
could.

Have you determined a suitable frequency for checking in your worker
thread? Where do you create the data caches, on the UI thread or the
worker thread?

Charles
"RMT" <no****@nospam. com> wrote in message
news:e6******** ***********@new s.demon.co.uk.. .

I am currently implementing a pattern that allows this to happen. It is
actually a non-trivial problem. My pattern uses a worker thread for
performing operations, I have my own data cache, ie. I don't use data
sets. The thread checks the cache in idle time to see if anything has
changed and fires off Update, Delete, Insert and Move (it's a tree
structure so I need this one) methods to it's listeners. UI components
(user controls) register with the data cache as listeners for these kind
of events and implement an IDataUpdateThre adNotification interface. In
actuality, there are over 60 different kinds of event. Note that the
worker thread does not directly alter the cache, it only reads it,
fetches any relevant data and then invokes a method on the cache object
to resolve any changes that were detected.

For example, consider I have a set of records in an array, stored in my
cache. The process would look like this:

(1) Thread is idling, so it decides to do a "coherency check"
(2) Thread creates a data connection and fetches the records
(3) Thread Invokes a method on the cache called "RecordsFetched "
...
(4) Cache compares all of the time stamps in the fetched records with
the current records and:

Any timestamps that are different, fires an Updated event to it's
listeners
Any records that exist in the fetched set but not in the cache, fires
an Inserted event to it's listeners
Any records that exist in the cache by not in the fetched set, fires
a Deleted event to it's listeners
Anyway, this is the basis I am working from with all of my (somewhat
complex) data structures. Perhaps it's easier with a single data set.
I would definatley avoid any server event notification systems - it's
too easy for your client to miss a message and thereby mess up your
state.


"Charles Law" <bl***@nowhere. com> wrote in message
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
Here's one that should probably have the sub-heading "I'm sure I asked
this once before, but ...".

Two users are both looking at the same data, from a database. One user
changes the data and commits it. How does the other user get the
updated view without polling for changes? Is there some sort of
callback mechanism that can be set up on the dataset or connection?

TIA

Charles



Jun 7 '06 #17
With SQL 2005, yes. With SQL 2000, it can be set up, but it will still poll
in the background. I am not sure about Oracle, but there is probably
something there. If the client is fully connected, you can build a
mechanism, as well, but you are on your own keeping track of who has what
data, which may cost more than the benefit of avoiding concurrency issues
rather than just reducing them.

--
Gregory A. Beamer

*************** *************** *************** ****
Think Outside the Box!
*************** *************** *************** ****
"Charles Law" <bl***@nowhere. com> wrote in message
news:uY******** ******@TK2MSFTN GP05.phx.gbl...
Here's one that should probably have the sub-heading "I'm sure I asked
this once before, but ...".

Two users are both looking at the same data, from a database. One user
changes the data and commits it. How does the other user get the updated
view without polling for changes? Is there some sort of callback mechanism
that can be set up on the dataset or connection?

TIA

Charles

Jun 7 '06 #18
> What is your specific scenario ?

An accountancy tool, that will start small, but will scale to multiple
users. Some of the screens might be left open for some minutes, whilst the
data backing them will be available to other users. Any or all of the users
could potentially modify the data, and the others must be able to see the
changes when they happen.

Charles
"Patrice" <sc****@chez.co m> wrote in message
news:Oo******** ******@TK2MSFTN GP04.phx.gbl...
I'm not really convinced by the bank sample. It could be blocked when the
transaction is actually processed IMO there is no need to see the amount
refreshed in real time. I'm not even sure the idea is not that it will be
blocked soon enough by the following transaction if not by the current
one....

The stock market price is much more convincing (but this is a niche not
something widely wanted). Several options would be :
- polling
- sql dependency
- callback coming from the server (using remoting, web services, broadcast
or multicast message etc)
etc...

What is your specific scenario ?

--
Patrice

"Charles Law" <bl***@nowhere. com> a écrit dans le message de news:
OS************* *@TK2MSFTNGP03. phx.gbl...
Hi Patrice

Thanks for the reply.
... such as plane reservation or something similar ...


That is a good example. Also, a bank call centre. The advisor is
referring to information on-screen whilst discussing details with a
caller. Transactions occur asynchronously, so the account balance could
change whilst the call is in progress. Unless the advisor repeatedly
presses an update button, they would not see the changes.

The stock market prices change by the second, and it is important that
traders have up-to-the-second prices on their screens. Polling is very
inefficient. The observer pattern was made for this scenario but I am
hearing that it can't be implemented on a database. I still think that
this _is_ widely wanted, but that we are largely being told that it can't
be done.

Charles
"Patrice" <sc****@chez.co m> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
AFAIK this is generally not widely wanted (after all if the other user
would have updated few minutes later, the user that is looking the data
would have not seen this change, so the first question is likely is this
that critical to have instant updates or is it enough to just see what
is current when you request for it comapred with the additional
complexity/processing cost ? If you have a special need, such as plane
reservation or something similar you may want to explain what you are
trying to do...).

--
Patrice

"Charles Law" <bl***@nowhere. com> a écrit dans le message de news:
u7************* *@TK2MSFTNGP05. phx.gbl...
Hi Cor

Sorry if I am not catching on very quickly, but I don't quite see how
your scenario would work.

> A dataset keeps track of the changed rows as long as you did not do
> acceptchanges.

Isn't this the dataset of the user who has made the changes? What about
the dataset of the user who is just viewing the data? Does that get
some notification of the changes as well?

> In the update process the code checks first row by row of those
> original rows are changed in the database. (Created new, deleted or
> updated).

This sounds like something that would happen when the second user tries
to make changes, in which case I agree that there would be some sort of
error because the data had already changed. But suppose the second user
is just looking at the data? Because datasets are disconnected in .NET
it seems to me that the second user might never see the changes unless
he specifically reloads the data.

Charles
"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:uu******** ******@TK2MSFTN GP02.phx.gbl...
> Charles,
>
> If you are using any kind of dataadapter/tableadapter and
> dataset/datatable than it is quiet easy.
>
> A dataset keeps track of the changed rows as long as you did not do
> acceptchanges.
>
> In the update process the code checks first row by row of those
> original rows are changed in the database. (Created new, deleted or
> updated).
>
> If that is the fact than you get a concurrency error.
> Be aware that accepted rows are handled, so the recovery process is
> not easy.
> (Although you can set the connection with a begintransactio n and a
> commit or non commit of that).
>
> Because of the fact that this situations in most situations is seldom,
> it is called optimistic concurrency.
> However you have to check it and creates the procedures.
> Even if that is telling setting everything back to the first state and
> telling the user to do his job again.
>
> Very simple is it not?
>
> Cor
>
> "Charles Law" <bl***@nowhere. com> schreef in bericht
> news:uY******** ******@TK2MSFTN GP05.phx.gbl...
>> Here's one that should probably have the sub-heading "I'm sure I
>> asked this once before, but ...".
>>
>> Two users are both looking at the same data, from a database. One
>> user changes the data and commits it. How does the other user get the
>> updated view without polling for changes? Is there some sort of
>> callback mechanism that can be set up on the dataset or connection?
>>
>> TIA
>>
>> Charles
>>
>>
>
>



Jun 7 '06 #19
Hi,

Then you need:

- A polling mechanism every n seconds
- Some specific notification system for updates provided by your database,
if available.

AFAIK, the standard database objects of the APIs (ADO, ODBC, etc.) don't
provide any of this.

Another approach is to prevent data modifications while a user is viewing it
(row-level locking). This is done in Oracle with a SELECT .. FOR UPDATE
statement, for example. Depending on your app, this kind of lock while
viewing data can be suitable or overkill.

All other approaches detect the conflict after the fact, when the second
user tries to modify data that was not the one that he got initially, as I
explained using a timestamp (or using dynamic recordsets, datasets, etc.
which I suppose that do the same internally)
--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com

"Charles Law" <bl***@nowhere. com> escribió en el mensaje
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi Carlos

Thanks for the reply. I was thinking more of an automatic way, so that the
second user is notified of the change when it happens, rather than if and
when he tries to make a change. This seems to me like something that would
be quite widely desired. I recollect now that I asked this before wrt web
applications, but I am now looking at a WinForms application, so perhaps
there is a way?

Charles

Jun 7 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12552
by: Christopher Koh | last post by:
how do you stop Access from saving any changed data in your tables and queries? like i just add or change data on the table/query tables,then click on X (exit)because i have no intention of saving it but access still automatically saves it even if I did not press the save command on the menu/toolbar? What is the solution for this? help thanks!
30
3405
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on the dataset or connection? TIA
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.