Solved

How do I get the updates that another user performed when using datasets in vb.net?

Posted on 2008-10-02
5
168 Views
Last Modified: 2013-11-26
Hello Experts,

I have been programming with vs.net since 2003 and have never really figured out how to do this. I have done numerous searches and have come up with nothing.

What I am trying to accomplish is this:
User A opens the application and connects to the database to fill the datasets.
User B opens the application and connects to the database to fill the datasets.

User A is viewing the information.
User B updates some records.

I want User A to see the updated information that User B made. How can this be accomplished?
0
Comment
Question by:kreylor
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:ladarling
ID: 22624498
If they are both working with datasets, the updates would not be available from the datasource until the changes to the datatables have been committed back to the datasource.
User A would need to execute, for example:
myDataSetTableAdapter.Update(myDataSource)

And then User B would need to refill their dataset, such as:
myDataSetTableAdapter.Fill(myDataSource)
0
 
LVL 11

Expert Comment

by:ladarling
ID: 22624513
Actually, from your example, the users would do that the other way round, but you get what I saying :-)
0
 
LVL 19

Accepted Solution

by:
elimesika earned 500 total points
ID: 22624672
HI

option 1
----------------
Trap the update on the window and implement the publish-subscribe pattern using events
This 3 part article has a good sample how to do that
http://www.devx.com/enterprise/Article/7976

option 2
----------------

1) Write a CLR SP as described in
http://www.vbdotnetheaven.com/UploadFile/pk_khuman/ManagedSP07032007014906AM/ManagedSP.aspx

2) Add a singleton that will store subscribers and has a subscribe/unsubscribe  and notify methods

3) Each client window having the dataset should call the subscribe method

4) When a client window is closed unsubscribe   should be called

5) Create a trigger on your DB table that invokes the notify method

6) the notify should loop on all current subscribers and notify them to refresh.

0
 

Author Comment

by:kreylor
ID: 22624741
I see what you are saying, but there are a few reasons not to do this.

This first reason is that if you have a lot of records, ex. 10,000, then it would take a very long time to refill. The second reason is that if User A is on, let's say, row 215. Once you refill the dataset then the user is kicked back to row 1. As you can tell, I have already tried this.

Is there any other solution on how to do this without using datasets? Is there a such thing as a user shared dataset? What I want is the ablility to move back and forth through the records and I don't think a datareader will work.
0
 

Author Closing Comment

by:kreylor
ID: 31502392
That was fantastic Elimesika. This is exactly what I was looking for!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question