Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

948 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

23 Experts available now in Live!

Get 1:1 Help Now