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
Chad SaarChad Saar 

Update an object with the WSDL (C#)

I am looking for an example of how to update an object using the WSDL. I am using Visual Studio with C#. Every example has the following example.

// Make the update call by passing an array containing the two objects. 

I don't understand why they are creating an array with two objects in order to update. There are two problems with this, I am NOT updating two objects, only one.

Also the method "update" does not exist in their WSDL library. Below is the code they recommend for updating an object and my code. Please advise, I just need the very last line of code that performs the update.

Recommended code which makes no sense to me.
// Make the update call by passing an array containing
        // the two objects.             
        SaveResult[] saveResults = binding.update(
            new sObject[] {updateContact, errorContact});
        // Iterate through the results and write the ID of 
        // the updated contacts to the console, in this case one contact.
        // If the result is not successful, write the errors
        // to the console. In this case, one item failed to update.
        for (int j = 0; j < saveResults.Length; j++) {
            Console.WriteLine("\nItem: " + j);
            if (saveResults[j].success) 
                Console.WriteLine("Contact with an ID of " +
                saveResults[j].id + " was updated.");

My code so far, missing the very last line of code to actually perform the update on my custom object.
SalesForce.QueryResult queryResult = null;

            String SOQL = "select from Annual_Program_Participation__c where Id = '" + textBox1.Text.ToString() + "'";

            queryResult = SfdcBinding.query(SOQL);

            SalesForce.Annual_Program_Participation__c app = (SalesForce.Annual_Program_Participation__c)queryResult.records[0];

            app.Course_Plan_Link__c = "";