Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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