Re: Concurreny with Datasets

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Ant,

I think that you are not doing it right.
So, you check whether the data wasn't changed on database and then you do an
update if data wasn't changed, correct?
If so, then it is wrong and a performance hit. What if somebody changes data
between your check and your update?
See, you can't know that data wasn't changed before doing an update (unless
you heavily lock your database) and you don't need to.
Just try to do an update wrapped in a transaction and using concurrency
checking. If the update succeeds then it is ok, if it doesn't succeed then
you will know that data was changed and decide what do to.

HTH
--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Ant" <Ant@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0B99D728-DCB5-4613-AD6A-6CC67D443998@xxxxxxxxxxxxxxxx
Hi, Cor,

Thanks for the advice. I think that's probably the best way. I didn't
realize that optimistic concurrency was a default. Now I see that it
throws
an error on finding the underlying data changed, I can work with that.
Thanks
again.


Hello Miha,

Why would I want to know? well, I have a server with a few clients each
holding a Dataset derived from the data on the server. Datasets are
disconnected. If one user updates a row back to the server on one client,
then another user updates the same row from a dataset on another client,
the
two different updates may cause data integrity problems. Which update
would
be correct? (what if only col 1 was updated in update 1 but only col 2 was
updated in update two; I would lose the col 1 update).

So I need to control this.
Hope this helps

Thanks for your help
Ant

"Miha Markic [MVP C#]" wrote:

Hi Ant,

Why would you need to know?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Ant" <Ant@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2CF2A466-F513-47BD-A6D3-6E83965A683A@xxxxxxxxxxxxxxxx
Hi,

Is there a way to check if a records in the underlying database have
been
updated by another client?

ds.HasChanges() method only tells you that the DataSet has changed from
the
initial underlying data, but how do you know if another client has
changed
the underlying data that you are just about to send changes to from
your
own
DataSet to?

Do you need to create a temporary DataSet to at the time of updating in
order to determine if any new changes exist against the modified
original
rows?

Is this how its done?

thanks for any ideas in advance
Ant





.



Relevant Pages

  • Re: Help with first VB application - Data Entry form
    ... I assumed a desktop / winform client application ... time' stamp from the database machine - control machine ... ... problem solved - web server is control system. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Help with first VB application - Data Entry form
    ... I assumed a desktop / winform client application ... time' stamp from the database machine - control machine ... ... problem solved - web server is control system. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Remobjects v KBM
    ... >> client query components) follow from that. ... Then, connections can be created to say SQL Server, Oracle, Interbase and ... can then be created from the abstract dataset definition in 'customers' to ... implicitly - this makes your code not be database connection specific). ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Help with first VB application - Data Entry form
    ... stamp from the database machine - control machine ... ... unnecessary data to the client ... ... and when building a database independent UI / Client - Server application, ... JavaScript, for example) and thus, will get the time from the web server, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Opinions needed about the best "Middleware suite" kbmMW vs. RODA
    ... kbmMW supports cross db in such way that all you need to do in your application is to set one property to switch to ... What one have to concentrate about is minimizing the amount of data moved from the app server to the client. ... C/S setup's usually have a quite active chatter going on between the client and the database, ...
    (borland.public.delphi.thirdpartytools.general)