Solved

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

Posted on 2008-10-02
5
166 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
That was fantastic Elimesika. This is exactly what I was looking for!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now