• JeffGress
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Simon posted this code a while back.
sforce.Account a1 = new sforce.Account();
a1.Name = "Account 1";
sforce.Account a2 = new sforce.Account();
a2.Name = "Account 2";
sforce.SObject [] objs = new sforce.SObject [] { a1, a2 };

sforce.SaveResult [] sr = binding.create(objs);
foreach (sforce.SaveResult s in sr)
{
if (s.sucess)
{
Console.WriteLine("new Id {0}", s.id);
}
else
{
Console.WriteLine("failed with error {0} {1}" s.errors[0].statusCode, s.errors[0].message);
}
}
Does this line:  sforce.SObject [] objs = new sforce.SObject [] { a1, a2 };
 create a single instance of sObject that contains a1 and a2 or multiple instances of objs?  Is there a way to just create a1, then add that to objs and create the next a1 repeatedly until objs has everything in it to pass to update?

I am tring to replicate this in a way where I don't have to name things A1, A2, etc?  What I would essentially like to do is run a query, take the results of the query and update a custom date field so that I don't pull this again.  Not knowing how many records I am going to pull makes it both difficult and cumbersome to create a1,a2.etc.  Can anyone help me with this?  My C# is rusty.   I think I am making it harder than it actually is.  I am used to creating an instance, using it and then creating a new instance, but since the update needs everything at once I don't know how to do that.

 

   Thanks,

 

     Jeff





Hi,

 

Anyone have experience using API Web Service from Progress programming language?

I managed to login, but do not know how to put the serverurl and sessionid into sforceservice.

Any sample will be very appreciated.

Thanks.

 

regards,

sq

Hi All ,

I am new to salesforce and programming. I am trying to Batch insert/update accounts using C#. Can someone please provide me a sample code which will do batch insert or updates?? I have gone through the sample examples but it inserts only one record. I am not sure how to use querymore ,batchsize , queryoptions etc

My source is SQL server database.

Please help !!

 

 

 

  • June 14, 2005
  • Like
  • 0