468,140 Members | 1,443 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

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

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

Oct 14 '06 #1
6 2094
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
"mike11d11" wrote:
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

Oct 14 '06 #2
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.

Oct 14 '06 #3
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
"mike11d11" wrote:
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.

Oct 14 '06 #4
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

"mike11d11" <mi*******@yahoo.comschreef in bericht
news:11**********************@h48g2000cwc.googlegr oups.com...
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

Oct 15 '06 #5
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??

Oct 15 '06 #6
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

"mike11d11" <mi*******@yahoo.comschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
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??

Oct 16 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by TJS | last post: by
2 posts views Thread by Richard | last post: by
4 posts views Thread by Al | last post: by
1 post views Thread by GoogleGroups | last post: by
5 posts views Thread by Mark Chambers | last post: by
3 posts views Thread by John Sheppard | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.