Re: How to handle concurrency issue with better performance?



In the SP that handles the updates.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Brooke" <tbrooked@xxxxxxxxxxx> wrote in message
news:eHVQGGIbHHA.1388@xxxxxxxxxxxxxxxxxxxxxxx
Would you put the timestamp check in the stored procedure on the server
side, or in the client side c# code?



"RobinS" <RobinS@xxxxxxxxxxxxxxx> wrote in message
news:gvCdnT3xivA-g5_bnZ2dnUVZ_qupnZ2d@xxxxxxxxxxxxxx
I use .Net 2.0 and VS2005, but I'm going to take a stab at answering your
question.

When you do the update on the dataset, it will only update the records
that have been modified since they were pulled from the database. So you
don't need to keep a separate table of those.

Instead of checking all of the fields for changes, what many people do is
store a timestamp in the database for the last update date/time. When
doing your update, you check to see if that value is the same, and if it
not, somebody else has updated the record since you pulled it. In this
way, you can have the WHERE clause on your update use the time stamp and
the primary key fields.

Hope this helps.
Robin S.
-----------------------------
"cherry" <cherryparadise001@xxxxxxxxx> wrote in message
news:1174529058.747242.168860@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am now thinking a method to handle the concurrency issue in my
program.
In .Net, the Command Builder Class will generate SQL automatically in
which it compares all the fields' original version with the version in
database as the update criteria and thus avoid overwriting others'
data.

In my case, I have a dataset retrieving data from joining several
tables and thus encounter error when use the DataSet.Update() method
of adapter directly.(cannot generate sql coz more 1 table in the
select command).
Therefore, I create stored procedure for the update command and assign
them to the dataset so that it can do the update. However, using the
concept of commandbuilder to handle concurrency issue, I have to
passing all the fields' original version to the stored procedure as
the where conditiion, the number of parameters might rise to about 30
to 40.
Will the preformance (esp. client) downgrade very much in using such
update method?

I was suggested by colleague to use 2 datasets, one is that I am using
right now and another will act as a image, storing the only table
which will be updated. So that when saving data to the database, I can
use the image DataSet's Update Command directly and needn't pass so
many parameters. But it seems that the synchonization between these 2
dataset is quite troublesome!

How you guys think? Which is better? or there is some better solution
which I may not know?
I am using VS.Net 2003 Enterprise to do the development, language is
VB .Net and the Database is Oracle 10g.
People using the application ~10-20, not a big number but the
performance of application must be as fast as possible due to the
business requirement.

Thanks in advanced.

Regards,
Cherry








.



Relevant Pages