Update problem using DBLinqDataSource on 2.5 release

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
grace
Posts: 7
Joined: Tue 31 May 2011 02:27

Update problem using DBLinqDataSource on 2.5 release

Post by grace » Tue 31 May 2011 02:43

I get error message 'Row not found or changed' when i tried to update data using DBLinqDataSource control.

I'm using entity generated from the database.

it has only string, boolean, integer, datetime data types.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 31 May 2011 09:29

This exception specifies that the entity state cached in DataContext does not correspond to the data stored at the server. This error usually occurs when the corresponding row in the database is modified or deleted after you've read it in your application.

For more information about this, please refer to
http://www.devart.com/linqconnect/docs/ ... Check.html

If these data cannot be modified by an external source, please specify the following so that we are able to analyze the issue in details:
- the DBMS you are using (e.g., Oracle or SQL Server);
- the fields of your entity that are checked on updates (i.e., the ones with 'Update Check' not equal to 'Never');
- the fields you've changed when the error occurred.

grace
Posts: 7
Joined: Tue 31 May 2011 02:27

Post by grace » Wed 01 Jun 2011 02:49

Now I know why it happens.

I don't know whether it's a feature or a bug, this error is due to the columns that I haven't selected in data binding such as gridview. I think your datacontext is putting null value into the columns that weren't included in the data binding and try to compare with the database so that it always fails.

if i change UpdateCheck to 'WhenChanged', it seems to be OK.
but all properties are 'Always' when generated automatically. I wonder whether there's a way to select an option when generating entities.

as another way, i'm using timestamp as IsVersion=true.
but still have the problem of when not included in databinding, it is failing.

Why does it need to be included in databinding when I don't need at all?

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 02 Jun 2011 14:29

This is the expected behaviour: since the grid has no information about the non-bound columns, the corresponding fields of the entity passed to the UpdateDataObject method of the data source are nulls. For example, GridView demonstrates the same behaviour with the standard LinqDataSource component.

As for changing UpdateCheck for multiple fields, it is possible to select a set of entity members and change UpdateCheck for them all (except the case this set contains an entity key).

grace
Posts: 7
Joined: Tue 31 May 2011 02:27

Post by grace » Wed 15 Jun 2011 04:22

Thank for your reply.

I'm just following your advice. but still converting is a bit painful. I think UpdateCheck=WhenChnaged should be more default behavior. if it can't be, if there's option to choose when creating model from the database would be perfect.

I'm actually converting ms linq to sql to linqconnect. so I'm sure this issue wasn't existing on ms linq to sql.

thanks.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 16 Jun 2011 12:24

We will analyze the possibility of supporting update operations in such a situation, and will consider adding an option defining the 'Update Check' default value.

We will inform you when any new information on either point is available.

Post Reply