all groups > dotnet windows forms databinding > october 2005 >
You're in the

dotnet windows forms databinding

group:

Concurrency


Concurrency Bud J via DotNetMonster.com
10/9/2005 7:29:40 AM
dotnet windows forms databinding:
i've been researching concurrency issues with ado .net for the past few days
and have found some trouble finding examples that suit my needs. Over and
over again the only two options i've found is either save the your changes
(DataRowVersion.Current) or don't (DataRowVersion.Original). Well neither of
those really fit. if jon changes the lastname of an employee and jack
changes the firstname then i want jon and jack's changes not either or.
Currently, i catch the dbconcurrencyexception(timestamp used to generate this)
and use the "id" of the row to send a statement back to the database so i
can compare the dbvalues for each field to the datasetvalues and comparing
the two will accomodate my jon and jack scenario. this all works fine but it
seems to me that sending back another statement is excessive at best. any
suggestions?

fyi
i use stored procedures for everthing(select,add,delete,changes)
i never use the commandbuilder and never will so no responses pertaining to
it please


--
Message posted via DotNetMonster.com
Re: Concurrency Miha Markic [MVP C#]
10/19/2005 1:52:21 PM
Hi Bud,

If you have timestamp field, you might do something like
"update SomeTable set bla bla where Id=@Id and TimeStampField = @TimeStamp"
and pass DataRowVersion.Original values of time stamp to @TimeStamp
parateter and id to @id.
So, if there are no changes, then something went wrong (somebody modifed the
record).
If you want also to refresh the timestamp after the update, you'll do
something like:
"update SomeTable set bla bla where Id=@Id and TimeStampField = @TimeStamp;
Select @TimeStamp where Id=@Id"
The question is if you are using a DataAdapter or Command object?

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

[quoted text, click to view]

Re: Concurrency Bud J via DotNetMonster.com
10/21/2005 12:25:43 AM
thanks for the reply


i've researched this a bit more since originally posting and discovered the
only solution is the one i currently have in place. i really wish there was
a more direct way but no luck


--
Message posted via DotNetMonster.com
AddThis Social Bookmark Button