Is it possible to implement such deferred read scenario?
Posted: Thu 27 Mar 2008 18:21
Hi.
I my project I need to implement following deferred read scenario:
1. I have a table with fields A,B,C,D,E. Field A is auto-increment ID, field B is unique name, fields C,D,E are large text fields.
2. Only fields A and B should be displayed in list, but before editing all fields for particular record should be fetched from DB and after editing stored back to DB.
3. Update should be based on A field only (ID) and only changed fields should be updated. So if two users edit the same record, but different fields, both changes should be applied.
Unfortunately I did not find any acceptable solution. What I have tried:
1. ReadComplete - absolutely doesn't work with typed dataset - generated SELECT completely wrong. With untyped dataset works, but selects C,D and E fields only (I need also refresh field B). Also after editing it's impossible to save changes in fields C,D,E - only field B appears in generated UPDATE (UpdateCommand is empty to achieve requirement 3). In WHERE in addition to A field, B field is also used (UpdatingKeyField is set to field A only).
2. RefreshRow - I'm able to select all required fields using RefreshingFields, but the same problem with updating DB as above.
3. Master (short record) - Details (full record). No problem with updating except A and B fields in WHERE instead of expected A. But additional steps for synchronization needed and additional datatable for just one record...
To sum-up: proposed in MyDirect deferred read feature does not work when data should be edited and saved back. There is odd behavior of CommandBuilder, when not only defined UpdatingKeyField appears in WHERE part of UPDATE, but also another unique field (B in my case).
May be there are some other ways to implement such scenario or avoid issue with UPDATE command generation?
Thanks
I my project I need to implement following deferred read scenario:
1. I have a table with fields A,B,C,D,E. Field A is auto-increment ID, field B is unique name, fields C,D,E are large text fields.
2. Only fields A and B should be displayed in list, but before editing all fields for particular record should be fetched from DB and after editing stored back to DB.
3. Update should be based on A field only (ID) and only changed fields should be updated. So if two users edit the same record, but different fields, both changes should be applied.
Unfortunately I did not find any acceptable solution. What I have tried:
1. ReadComplete - absolutely doesn't work with typed dataset - generated SELECT completely wrong. With untyped dataset works, but selects C,D and E fields only (I need also refresh field B). Also after editing it's impossible to save changes in fields C,D,E - only field B appears in generated UPDATE (UpdateCommand is empty to achieve requirement 3). In WHERE in addition to A field, B field is also used (UpdatingKeyField is set to field A only).
2. RefreshRow - I'm able to select all required fields using RefreshingFields, but the same problem with updating DB as above.
3. Master (short record) - Details (full record). No problem with updating except A and B fields in WHERE instead of expected A. But additional steps for synchronization needed and additional datatable for just one record...
To sum-up: proposed in MyDirect deferred read feature does not work when data should be edited and saved back. There is odd behavior of CommandBuilder, when not only defined UpdatingKeyField appears in WHERE part of UPDATE, but also another unique field (B in my case).
May be there are some other ways to implement such scenario or avoid issue with UPDATE command generation?
Thanks