Need help updating my dataset with changes made on the Source? Getchanges Merge?

  • Thread starter Thread starter mike11d11
  • Start date Start date
M

mike11d11

I'm trying to create an application that will have multiple users
working off a table on a SQL server. Since multi users will be
updating different records at any given moment, how can i get those
changes and merge them into my current Dataset. I've been playing
around with the GetChanges method and Acceptchanges but they just dont
seem to be pulling over the changes and updating my Dataset. Maybe if
someone could give me a sample of Code to use or try, anything is
appreciated. Here is what I'm trying in my code but doesnt work.

Try
Me.AccuLogic_SQLDataSet.GetChanges()
Me.AccuLogic_SQLDataSet.AcceptChanges()

Me.Collect_Work_List_BackupTableAdapter.Update(Me.AccuLogic_SQLDataSet.Collect_Work_List_Backup)
MessageBox.Show("The update was successful!")
Catch ex As Exception
MessageBox.Show("Update Failed " & ex.Message.ToString,
ex.GetType.ToString)
End Try
 
mike11d11,

None of the ADO.Net data objects, such as dataset, etc., support getting
changes made to the database by other users. The data access architecture is
disconnected, after all.

The newest versions of SQL Server offer some notification services, but most
other databases don't offer that feature. I don't have any experience with
that feature and I wonder if it would scale well.

The obvious technique would be to query the database at regular intervals.

Kerry Moorman
 
I know it is disconnected and I have it to where when changes are made
in the app they are immediatley sent to the SQL server table. But how
do I get the changes that someone else has made on a record into my
Dataset. I was going to just add it to my process when I send an
update to the server I will go ahead and see if there are any changes
to any other records in my Dataset that I need to pull back and update
or merge, I dont know how to use these methods correctly. Any
explanation would be great of how to use Getchanges or merge.
 
mike11d11,

AS I said, GetChanges, Merge, etc., do not have anything to do with
retrieving changes made to the database by other users.

You will need to re-query the database to get changes made by other users.
In other words, you will need to do use a datadadpter to fill a datatable
with data from the database. This will get the most up-to-date rows from the
database.

Kerry Moorman
 
Mike,

In addition to Kerry,

The idea of keeping data connected is based on the idea that everybody is
working at the same moment.

But that is not. So trying to get it all updated, that is only as it is
processed by somebody.

Let give an example if a bookkeeper is first processing his incoming money
and than does the payments his boss will think (if he is connected) that
there is a lot of money in cash, while it is not.

With this I will not say that there are no situations that it is important
to know first the latest processing before you can go on. (By instance money
automats).

Cor
 
So in this scenario, if I wanted to see other peoples changes on
accounts I would have to clear my dataset and pull in the entire set
again? Is there a way to compare my dataset records to the records on
the server and just pull in the ones that have changes since this is a
disconnected enviornment??
 
Mike,

Not with a standard approach and in fact you have to read the complete
dataset again.

If you use timestamps than you are shorter to your goal.

Cor
 
Back
Top