From: Glenn Welker on
Simply one row deleted from datagridview.

In the UserDeletedRow event we:
called endedit on the bindingsource for the grid and then call the
tableadapter.update on the dataset. The update method is when the
concurrency error happens.

Totally confused. This couldn't be a simpler example. One table with a
few columns with a single deleted row.

Ideas?
From: Patrice on
Hello,

Optimistic concurrency is checked by selecting the row using the original
values in the where clause. If one of the values stored in the DB is
truncated because of a precision problem, the where clause won't return the
original row resulting in a concurrency error.

Which DB are you using With SQL Server just use the profiler to see the
delete statement and play with the where clause to find out which criteria
make the query to fail (starting with dates). You may want also to do the
same thing programmatically without using the datagridview. It would allow
to find out if the datagridview have something to do with the issue (IMO
not)...

--
Patrice

"Glenn Welker" <gwelker(a)gmail.com> a �crit dans le message de
news:58335e74-5ca5-4d02-a03b-37f4af3b4415(a)o16g2000vbf.googlegroups.com...
> Simply one row deleted from datagridview.
>
> In the UserDeletedRow event we:
> called endedit on the bindingsource for the grid and then call the
> tableadapter.update on the dataset. The update method is when the
> concurrency error happens.
>
> Totally confused. This couldn't be a simpler example. One table with a
> few columns with a single deleted row.
>
> Ideas?

From: Patrice on
> Rather than using compare all, use a datestamp.
> Update the time when you update.
> If someone else updated it since you read the data then you can tell
> because the datestamp will be different.
> Add Last_Updated_user Id as a colummn as well and you can also tell the
> user who changed their data.

Good point Andy, forgot to mention this as I focused on finding first if
this is the issue.

Glenn, if this is the issue and you are using SQL Server you can use the
rowversion datatype. The value is automatically updated when you insert or
update a row and is then use automatically to check for concurrency so you
have nothing to change to benefit from this beyond adding this column.
--
Patrice


From: Patrice on

> I am using SQLite and this app only runs in a single user scenario. It
> appears that the grid is doing something to one of my column values.
> Haven't got it completely narrowed down, but I am guessing that it is
> probably my date column. Once I stripped my 9 columns back to 2 it
> works without errors.

Ok then you could dump the Dataset to see differences between the new values
and the original values. It should reveal what value unexpectedly changed
because of a possible precision problem

Also a quick look at http://www.sqlite.org/datatype3.html made me think it
could be some kind of dynamic typing issue (something such as reading a 3.2
value being stored back later as a "3,2" (due to country convention) string
as SQLite seems to be able to dynamically type each value).

--
Patrice