• chance3398
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

I have seen many code samples here using binding.xxxxx - everytime I have tried this I get "The name binding does not exist in this context".

 

Sample code I am using (and I put Using System.data at top)

 

 Account account1 = new Account();
            Account account2 = new Account();
            // Set some fields on the account1 object. Name field is not set
            // so this record should fail as it is a required field.
          
            account1.BillingCity = "Wichita";
            account1.BillingCountry = "US";
            account1.BillingState = "KA";
            account1.BillingStreet = "4322 Haystack Boulevard";
            account1.BillingPostalCode = "87901";
            // Set some fields on the account2 object
            account2.Name = "Golden Straw";
            account2.BillingCity = "Oakland";
            account2.BillingCountry = "US";
            account2.BillingState = "CA";
            account2.BillingStreet = "666 Raiders Boulevard";
            account2.BillingPostalCode = "97502";
            // Create an array of SObjects to hold the accounts
            sObject[] accounts = new sObject[2];
            // Add the accounts to the SObject array
            accounts[0] = account1;
            accounts[1] = account2;
            // Invoke the create() call
            
          SaveResult[] saveResults = binding.create(accounts);