Retrieving new information

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

Hi,

I'm an ADO.NET beginner. I have an application in which all my database
updates are done on the main form. It includes numerous dialogs which
access the dataset information, then the dataset is updated when returning
to the main form. If one user goes to one form and edits new data and
enters new rows, the database itself is updated accordingly, but that new
information is not retrieved by other users. How can I fill the dataset
with new/different information entered by other users without clearing all
the dataset tables and refilling them?

Thanks,
Nathan
 
Nathan,

Very easy, you cannot.

You can use timestamps, read those parts that are new or updated and merge
those, however than you still don't have the rows that are deleted by other
users.

It does not help directly however maybe a little bit with searching.

Cor
 
It's an age-old problem and a good question. I lectured on this at MSU
and it took an hour or so to discuss--let's see if I can boil it down to a
few paragraphs. Basically, the DBMS (like SQL Server) is a data repository.
An application connects to this data source and retrieves the current state
of the rows stored there. In a disconnected architecture, those rows are
simply copies of the row state at that point in time. The instant you fetch
the rows other users can change the data state and your copy is now out of
date. If you add, change or delete rows and post these changes to the
database, other users will only see these changes (in this architecture)
when they next refetch the rows. The server connection is basically like a
phone call to a librarian. If new books come in, they won't call you to
inform you.
In a server-side cursor architecture, many of these issues are
addressed. In this case, when you execute a SELECT you don't fetch the row,
but a key that addresses a row that's a member of the cursor based on the
WHERE clause. Your application can fetch N rows from the cursor to show to
the user--basically getting a copy of the rows in their current state. As
you navigate through the cursor, the current state is returned from the
database so you see changes (just updates and deletes) made to the database.
You don't see new rows added by other users unless you ask for a dynamic
cursor (which are expensive to build). You do see changes made by other
users as you navigate to a specific row. Server-side cursors are supported
in ADO classic but not in ADO.NET. However, (as I describe in a whitepaper
on my site) you can create a server-side cursor to implement this
architecture.
Another new technology that's available now and being integrated into
Whidbey/Yukon (notification services) permits you to create a data structure
(a DataSet in ADO.NET) and be notified via an event that the data has
changed.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Would it be wise, then, (if I wanted a simple solution), for me to refresh
my dataset by clearing all the tables and refilling them with the current
data? I would do this when each time I call a form that accesses the data.
This would be a little annoying, however, because of a time delay before the
forms load.
 
Nathan,

In my opinion does this depends how you use the data, by instance how
important is it that the user has the latest information.

When the update from the other user could have be done tomorrow, while that
does not affect the work of the user, than it is something else than when it
is very important that the user has the absolute latest information, in the
first situation there are more possibilities what actions there have to been
taken.

However, when it is by instance about money or order or other transactions
than it is clear for me, only the absolute latest correct data has to be
updated.

Just my thought,

Cor
 
Back
Top