Solved

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

Posted on 2008-10-02
5
170 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

685 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