Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem with optimistic concurency - What's going on here?

Reply
Thread Tools

Problem with optimistic concurency - What's going on here?

 
 
=?Utf-8?B?Qi4gQ2hlcm5pY2s=?=
Guest
Posts: n/a
 
      11-15-2007
Ok, I'm out of practice in web work, I've never done any webwork in 2.0, and
I have to come up with a VB/Dot Net 2.0 web site in a week or two. Business
as usual.

First, I know I can't trust Visual Studio to create the correct Update
statement so every update string has to manually updated. I have a table
with a timestamp field and I'm trying to make it work. Here is the current
update statement:
UPDATE tblProject SET RK_Unit = @RK_Unit, RK_PG = @RK_PG, ID = @ID, Name
= @Name, [Desc] = @Desc, RK_Class = @RK_Class, G0 = @G0, Notes = @Notes
WHERE (PK = @PK) AND (@IsNull_upsize_ts = 1) AND (upsize_ts IS NULL) OR
(PK = @PK) AND (upsize_ts = @upsize_ts)

When I try to do an update from a bound DetailsView, I get this error: Value
cannot be null. Parameter name: IsNull_upsize_ts

So far as I can remember, I have not changed anything relating to logic
involving the timestamp or this @IsNull parameter. I'm really not clear
what's going on here or exactly what the @IsNull parameter's purpose is.
(Haven't dealt with timestamps for a while either.)

Could someone please explain this?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      11-15-2007
Well, a timestamp is just a self-updating column type that changes when
anything in the row changes. So this is compared with the timestamp value
that came back with the data you are editing, and if they are different, that
means somebody else updated the row while you were "working on it". But, have
no idea how you got "(@IsNull_upsize_ts " - that's a parameter. More likely
the SQL would be like
"IsNull(@upsize_ts)" - IsNull should be returning bool. You probably need
to post more code to clarify.

--Peter
"Inside every large program, there is a small program trying to get out."
http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://www.blogmetafinder.com



"B. Chernick" wrote:

> Ok, I'm out of practice in web work, I've never done any webwork in 2.0, and
> I have to come up with a VB/Dot Net 2.0 web site in a week or two. Business
> as usual.
>
> First, I know I can't trust Visual Studio to create the correct Update
> statement so every update string has to manually updated. I have a table
> with a timestamp field and I'm trying to make it work. Here is the current
> update statement:
> UPDATE tblProject SET RK_Unit = @RK_Unit, RK_PG = @RK_PG, ID = @ID, Name
> = @Name, [Desc] = @Desc, RK_Class = @RK_Class, G0 = @G0, Notes = @Notes
> WHERE (PK = @PK) AND (@IsNull_upsize_ts = 1) AND (upsize_ts IS NULL) OR
> (PK = @PK) AND (upsize_ts = @upsize_ts)
>
> When I try to do an update from a bound DetailsView, I get this error: Value
> cannot be null. Parameter name: IsNull_upsize_ts
>
> So far as I can remember, I have not changed anything relating to logic
> involving the timestamp or this @IsNull parameter. I'm really not clear
> what's going on here or exactly what the @IsNull parameter's purpose is.
> (Haven't dealt with timestamps for a while either.)
>
> Could someone please explain this?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Qi4gQ2hlcm5pY2s=?=
Guest
Posts: n/a
 
      11-16-2007
That's kind of a problem. There's very little code to post. I'm trying to
write this web site, at least for now, by relying on VS and ASP's built in
tools and defaults. (That "(@IsNull_upsize_ts" was generated by Visual
Studio, hence my confusion.) I've bound controls and when I try to use this
update script, it crashes. If I cut out all references to the timestamp,
update works fine. For prototyping this does not matter, but it probably
would be good form to get this working in the long run. (I'll worry about it
after Thanksgiving.)

Thanks.

"Peter Bromberg [C# MVP]" wrote:

> Well, a timestamp is just a self-updating column type that changes when
> anything in the row changes. So this is compared with the timestamp value
> that came back with the data you are editing, and if they are different, that
> means somebody else updated the row while you were "working on it". But, have
> no idea how you got "(@IsNull_upsize_ts " - that's a parameter. More likely
> the SQL would be like
> "IsNull(@upsize_ts)" - IsNull should be returning bool. You probably need
> to post more code to clarify.
>
> --Peter
> "Inside every large program, there is a small program trying to get out."
> http://www.eggheadcafe.com
> http://petesbloggerama.blogspot.com
> http://www.blogmetafinder.com
>
>
>
> "B. Chernick" wrote:
>
> > Ok, I'm out of practice in web work, I've never done any webwork in 2.0, and
> > I have to come up with a VB/Dot Net 2.0 web site in a week or two. Business
> > as usual.
> >
> > First, I know I can't trust Visual Studio to create the correct Update
> > statement so every update string has to manually updated. I have a table
> > with a timestamp field and I'm trying to make it work. Here is the current
> > update statement:
> > UPDATE tblProject SET RK_Unit = @RK_Unit, RK_PG = @RK_PG, ID = @ID, Name
> > = @Name, [Desc] = @Desc, RK_Class = @RK_Class, G0 = @G0, Notes = @Notes
> > WHERE (PK = @PK) AND (@IsNull_upsize_ts = 1) AND (upsize_ts IS NULL) OR
> > (PK = @PK) AND (upsize_ts = @upsize_ts)
> >
> > When I try to do an update from a bound DetailsView, I get this error: Value
> > cannot be null. Parameter name: IsNull_upsize_ts
> >
> > So far as I can remember, I have not changed anything relating to logic
> > involving the timestamp or this @IsNull parameter. I'm really not clear
> > what's going on here or exactly what the @IsNull parameter's purpose is.
> > (Haven't dealt with timestamps for a while either.)
> >
> > Could someone please explain this?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Optimistic Concurrency in a web app Andrew Robinson ASP .Net 4 02-05-2007 04:02 PM
datagridview optimistic concurrency null problem russganz@gmail.com ASP .Net 0 09-18-2006 02:32 AM
SqlDataSource and Optimistic Concurrency Problems stuart.d.jones@gmail.com ASP .Net 2 01-31-2006 09:23 AM
Optimistic concurrency in custom GridView/SqlDataSource =?Utf-8?B?TWlrZSBLZWxseQ==?= ASP .Net 8 01-04-2006 03:11 PM
Writing to URL connection-concurency TonY Java 0 12-14-2004 12:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57