a web app. At first I thought this would be easy. We generate our own
entities and dal/service layer but I now see that working with controls like
a grid view pose some very complicated issues.
If I am using rowversion, when do I start the "clock"? When I first display
the label version of a field? when I display the data within a textbox for
edit or when I read the record for the 3rd time before updating new values
on the edit postback? And finally, where do I store rowversions for all of
these records in a web app since it doesn't look like they can be stored as
part of the gridview?
I am guessing that someone has wrestled with this alligator before. Any
suggestions or is this something that is so plagued with problems that it I
would just be better off not implementing it.
-Andythere are two approaches.
1) in the update compare every before value in the where clause (this is
how the asp.net datasource wizards work). so if any column was changed,
the update is rejected (row count == 0)
2) add a timestamp to each row, and compare on update.
-- bruce (sqlwork.com)
Andrew Robinson wrote:
Quote:
Originally Posted by
I am working on a system system that requires optimistic concurrency
within a web app. At first I thought this would be easy. We generate our
own entities and dal/service layer but I now see that working with
controls like a grid view pose some very complicated issues.
>
If I am using rowversion, when do I start the "clock"? When I first
display the label version of a field? when I display the data within a
textbox for edit or when I read the record for the 3rd time before
updating new values on the edit postback? And finally, where do I store
rowversions for all of these records in a web app since it doesn't look
like they can be stored as part of the gridview?
>
I am guessing that someone has wrestled with this alligator before. Any
suggestions or is this something that is so plagued with problems that
it I would just be better off not implementing it.
>
-Andy
Bruce,
I am pretty familiar with what you pointed out. My question was more about
how to handle and more specifically when to store the timestamp value: from
the initial server postback, after an edit control is displayed to the user
or finally when the user posts back. There are three different options here.
And then, how do you handle saving the timestamp across those postbacks for
multiple rows in the case of a gridview.
Thanks,
"bruce barker" <nospam@.nospam.comwrote in message
news:eUxjn%23ZRHHA.4756@.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
there are two approaches.
>
1) in the update compare every before value in the where clause (this is
how the asp.net datasource wizards work). so if any column was changed,
the update is rejected (row count == 0)
>
2) add a timestamp to each row, and compare on update.
>
>
-- bruce (sqlwork.com)
>
Andrew Robinson wrote:
Quote:
Originally Posted by
>I am working on a system system that requires optimistic concurrency
>within a web app. At first I thought this would be easy. We generate our
>own entities and dal/service layer but I now see that working with
>controls like a grid view pose some very complicated issues.
>>
>If I am using rowversion, when do I start the "clock"? When I first
>display the label version of a field? when I display the data within a
>textbox for edit or when I read the record for the 3rd time before
>updating new values on the edit postback? And finally, where do I store
>rowversions for all of these records in a web app since it doesn't look
>like they can be stored as part of the gridview?
>>
>I am guessing that someone has wrestled with this alligator before. Any
>suggestions or is this something that is so plagued with problems that it
>I would just be better off not implementing it.
>>
>-Andy
Hello Andy,
As for the Timestamp column in SQL Server, it is mapped to SqlBinary(for
SqlDataTypes) and byte[](for .net type). And if you want to use such as
custom column and detect confliction, you may need to manually use
SqlCommand or SqlDataAdapter to perform the update statement execution,
here is a knowledge base article describe on this:
#HOW TO: Use a TimeStamp Column to Detect Update Collisions in ADO.NET with
Visual C# .NET
http://support.microsoft.com/kb/317095/en-us
For the ASP.NET 2.0 SqlDatasource based databound, it only support two
built-in concurrency detection approachs:
1. Compare all the columns in table(do not include any timestamp type
column since SqlDataSource can not handle this type for type mapping)
2. Override the old value anyway.
So if you still want to utlize the DataSource mode, I suggest you consider
use ObjectDatasource and use a custom Data Access class which expose the
"Select", "Update", "Delete" ... methods.
Hope this helps some.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...rt/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Hello Andy,
Have you got any further progress on this? Does the concurrent control
suggestion in previous message helps some. As for the timestamp column
issue. Currently, we haven't direct means to handle it in the GridView or
such databound template control. If you do need some further thorough
workarounds or solution, I would suggest you contact CSS for further
assistance.
http://msdn.microsoft.com/subscript...rt/default.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
0 comments:
Post a Comment