Reference database application request

J

John

Hi

I am looking for a sample master-detail database winform application that
handles multi-user issues like concurrency violations to inspect its code
for good db development practices. Would appreciate link to any such app.

Many Thanks

Regards
 
C

Cor Ligthert[MVP]

John,

For what you ask is no standard solution, the way it can be done has endless
possibilities.

A search for a good one which fits in your situation will be a lot in the
lottery.

You have to do it yourself, with first writing down what your policy will be
at a concurrency error.

Cor
 
J

John

Cor, anything that can get me started at a reasonably sane level is fine. I
am not looking for all possible ways to do things just any one way that does
it good enough.

Thanks

Regards
 
S

Steve Gerrard

It seems to me that just running one of the gee-wizards to create a dataset and
tableadapter would tell you enough. Drag and drop, and click generate, and you
can see how MS sets up an update query to update the Authors table in
Biblio.mdb.

The strategy used is to pass the old value of every column as a parameter, along
with the new value of every column as a parameter. It then constructs a Where
clause in the SQL that checks that every old value is still there, or still null
as the case may be. That means the update will only update if the underlying
data has not changed in the meantime.

It is too awkward looking for my taste, I prefer using timestamps to keep track
of what has changed; but it is one way of getting it done.
 
J

John

Hi Steve

I know this much. I am looking to see how a detail-master app works
specially in terms of multi-user issues like concurrency violation handling.
It would be nice to see how a pro handles various real issues in a working
db app.

Thanks

Regards
 
S

Steve Gerrard

I guess I'm not sure what you are expecting to find. The Where clause approach
described is one way of checking whether data has been changed by another user
before performing an update. Any approach to managing multi-user concurrency is
going to be along these lines, whether it uses timestamps, or a test of all data
columns, or some other mechanism. The only other option is to lock records at
the time they are retrieved, which is generally not a good idea.

If there are several tables involved in an update, the update can be wrapped in
a transaction, and you can add code to rollback the entire transaction if any of
the individual rows are not updated successfully. I'm not sure if you will find
a complete example of that anywhere, but you should be able to find examples of
using a transaction.
 
C

Cor Ligthert[MVP]

John,

As you have a concurrency violation (you can see that with a standard
dataadapter update on the returned errorstate of a datarow), then you have
some possibilites, however the first one is to show it to the user.

And then you can tell him to do it over again after you have got the new
values from the database.

You can show the new values and ask if it should be replaced by the just
typed ones and do that like this.

However all is up to you, don't think that this will happen often,
concurrency errors should be in most situations rare.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Sample app 1
OleDbPermission failed 4
Access Locks Up 25
WinForm app speed issue 3
Linq2Sql issues 10
Multi threaded app database access 5
Database update help needed 6
IIS Web Application Deteriorates 4

Top