SaveDataSet

The SaveDataSet method modifies a collection (inserting, updating, or deleting records) using the UpdateCollection method of an IDO.

Syntax

public DataSet SaveDataSet( string strSessionToken,
                            DataSet updateDataSet,
                            bool refreshAfterSave,
                            string strCustomInsert,
                            string strCustomUpdate,
                            string strCustomDelete )

Parameters

Name Description
strSessionToken This is the session token obtained through a call to the CreateSessionToken API.
updateDataSet This parameter specifies the data set that contains records to be updated.
refreshAfterSave When set to TRUE, this parameter specifies that the data set records to be updated are to be refreshed and returned to the caller.
strCustomInsert This parameter is a comma-delimited list of methods and/or instructions which override the default save behavior.
strCustomUpdate This parameter is a comma-delimited list of methods and/or instructions which override the default save behavior.
strCustomDelete This parameter is a comma-delimited list of methods and/or instructions which override the default save behavior.

Output

Returns a data set containing rows refreshed after the save. If the refreshAfterSave parameter is set to FALSE, this method returns a value of 'null'.

Example 1 – Insert action using SaveDataSet

string sessionToken = "b/XdI6IQzCviZOGJ0E+002…5vl903teP0jSDwkFs";
DataSet insertDS = new DataSet( "UserNames" );
DataTable idoTable = insertDS.Tables.Add( "IDO" );
idoTable.Columns.Add( "Username", typeof( string ) );
idoTable.Columns.Add( "UserDesc", typeof( string ) );
idoTable.Rows.Add( new object[] { "wsmiith", "Will Smith" } );
 
IDOWebService.DOWebServiceSoapClient soapClient = new 
IDOWebService.DOWebServiceSoapClient();
DataSet updatedDS = soapClient.SaveDataSet( sessionToken, insertDS, true, 
string.Empty, string.Empty, string.Empty );

Example 2 – Update action using SaveDataSet

string sessionToken = "b/XdI6IQzCviZOGJ0E+002…5vl903teP0jSDwkFs";
// GetDataSet makes a call to the LoadDataSet web service method to get the collection
DataSet ds = GetDataSet();
DataTable idoTable = ds.Tables["IDO"];
// Row to be updated
DataRow row = idoTable.Rows[2];
// Update the record’s property value
row["UserDesc"] = "John Doe Sr.";

Example 3 – Delete action using SaveDataSet

string sessionToken = "b/XdI6IQzCviZOGJ0E+002…5vl903teP0jSDwkFs";
// GetDataSet makes a call to the LoadDataSet web service method to get the collection
DataSet ds = GetDataSet();
DataTable idoTable = ds.Tables["IDO"];
// Record to be deleted
var row = idoTable.Rows[3];
row.Delete();
 
DataSet updatedDS = IDOSoapClient.SaveDataSet( sessionToken, ds, true, string.Empty, string.Empty, string.Empty );