function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ASmithASmith 

Updating SFDC using a DataSet

Does anyone have sample code for how to update SFDC from a DataSet?  I was hoping to review the code used for the Data Editor in the sForce Explorer project, but I'm having trouble locating that particular section of code in the source files.  Is this even available?

In the end I would like to use the DataSet.Update sub in conjunction with sForce .Net Provider, but any examples would be greatly appreciated.

DevAngelDevAngel

Hi ASmith,

The sforce Explorer data editor uses a user control called frmEditList.  On that form there is an event handler named Bindingn_PositionChanged.  This handler handles updates and deletes using a dataset.

The delete part walks through the deleted records and deletes them one at a time.  The update part does a batch update (of course since it is fired on PositionChanged it will end up doing one at a time).  The PositionChanged event is fired when navigating rows in the datagrid. 

The sforce Data Provider uses the sforceDataAdapter.Update method to affect changes.  It works basically the same way as the sforce Explorer.  DataSet, by the way, does not have an update method.

ASmithASmith

Thanks DevAngel!

Am I correct in assuming that it isn't possible to have the DataAdapter.Update method execute the updates in a sForce update batch?

DevAngelDevAngel

Hi ASmith,

Not in its current implementation.  I have worked out the code for this, but have not submitted for approval.