updating tables from disconnected dataset

  • Thread starter Thread starter Ramsey Schaffnit
  • Start date Start date
R

Ramsey Schaffnit

I can retrieve, e.g. from a web service, my custom dataset and manipulate
its contents just fine, thank you.

Now I want to update the database.

I'm sure there must be how-to or best-practice articles about how to do
this. Can someone please give me a pointer?
 
This seems no different from a normal scenario. You will have to use the
appropriate DataAdapter. Is there something I am missing here?

Andrew Conrad
Microsoft Corp
 
Yes, it's the normal scenario. If I pull down all the records related to my
object, that could be a 'bunch'. If I modify one, I don't want to send the
whole dataset back to the server and let it sort out what's changed. At
least I would think that's bad practice.

What I'm looking for is the 'normal' way to sort out the changes and send
back the minimal amount of data over the connection. (N.B. not a direct
database connection.)

I'd think I have to create another dataset in the same format with only the
changed records, but it's not obvious to me that there wouldn't be a better
way.
 
Check out DataSet.GetChanges method. It sounds like that is what you need.

Andrew Conrad
Microsoft Corp
 
I'm sure that's part of it. (And thank you for your response.)

This must be terribly obvious or terribly obscure.

Is it, in fact, the 'normal' way for a client with no database connection to
pass back changes from a dataset to, e.g., a web service by constructing
*another* dataset containing only the changes, then passing the new, smaller
dataset?

I have seen no examples where the client is working without a direct
connection to the database.

The 'normal' update code *has* a connection to the database directly and
can, therefore, chat with the database about individual records. One would
think this undesirable when dealing with a web service.
 
thanks for the feedback. I have passed it onto the MSDN folks - I think
you are right in that this is the 90% case and we should probably have some
documented samples of the scenario.
Andrew Conrad
Microsoft Corp
 
Back
Top