Bauhaus
5/14/2008 5:06:00 PM
"Scott M." <smar@nospam.nospam> schreef in bericht
news:uBGk1hItIHA.5268@TK2MSFTNGP06.phx.gbl...
> Concurrency errors indicate that a change being attempted conflicts with
> the reality of the data (i.e. two users editing simultaneously: one simply
> updates a field, while the other person deltes the record and the delte is
> committed before the update is).
Thanks for your replies.
I finally figured it out:
With the Access database, the field PizzaNr is not an autonumber. When I
tried the same database, but in sqlexpress, where I did give PizzaNr an
autonumber, I also got an error, but a different one: "Cant convert DBNull
to Integer".
So it had something to do with PizzaNr, since that was the only field of
type integer.
Then it suddenly hit me when I looked again at my gridview: in the gridview,
PizzaNr starts from 0...
So what happens is this: when the field is an autonumber, the
gridview/objectdatasource knows the field starts from 1. When the field isnt
an autonumber however, the field should start from 0 ...but in Access I gave
my first non-autonumber PizzaNr the value 1. Result: the code looks for a
PizzaNr with value 0 but doesnt find it so it throws an exception.
The reason I got the "Concurrency violation" was also because of this, 'cos
the code I wrote to detect multi-user conflicts also looks for a PizzaNr
with value 0...
So when I ommitted the code to detect multi-user conflicts AND changed
PizzaNr in my Access database to an autonumber, it worked fine.