|
Merging DataSet (Added and Unchanged): msg#00330windows.devel.dotnet.winforms
The docs state "When merging a new source DataSet into the target, any source rows with a DataRowState value of Unchanged, Modified, or Deleted, are matched to target rows with the same primary key values. Source rows with a DataRowState value of Added are matched to new target rows with the same primary key values as the new source rows." This part: "Source rows with a DataRowState value of Added are matched to new target rows with the same primary key values as the new source rows." h as always confused me. Our app sends an Added DataRow to our DAL (we call the client Dataset's GetChanges method and send this smaller DataSet across the wire). Our DAL does the insert. A primary key is returned as part of the insert. The DataRow now has the PrimaryKey value and is now marked as Unchanged. The client 'Added' DataRow does not have the PrimaryKey though. It is storing a dummy PrimaryKey. So, we return to the client with an Unchanged DataRow that is storing the correct PrimaryKey from sql server. So, how can this 'match' work? The Source DataRow is marked as Added. However, the returning DataRow's PrimaryKey will never match. What we do now, is just prior to calling Merge, we remove all Added DataRows from the client DataSet. The we call Merge. This works, but seems like extra overhead to me. Greg Robinson Custom Data Systems, Inc. www.cds-am.net |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: "W" gets chopped up on Labels: 00330, Adam Tuliper |
|---|---|
| Next by Date: | Re: Textbox on non-active tabcontrol page: 00330, Price, Derek |
| Previous by Thread: | "W" gets chopped up on Labelsi: 00330, Greg Robinson |
| Next by Thread: | Re: Merging DataSet (Added and Unchanged): 00330, philip sayers |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |