SHARE
TWEET

Untitled

a guest Jun 18th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void querySample()
  2. {
  3.     try
  4.     {
  5.         QueryResult qr = null;
  6.         binding.QueryOptionsValue = new sforce.QueryOptions();
  7.         binding.QueryOptionsValue.batchSize = 250;
  8.         binding.QueryOptionsValue.batchSizeSpecified = true;
  9.  
  10.         qr = binding.query("SELECT FirstName, LastName FROM Contact");
  11.  
  12.         bool done = false;
  13.         int loopCount = 0;
  14.         while (!done)
  15.         {
  16.             Console.WriteLine("nRecords in results set " +
  17.                 Convert.ToString(loopCount++)
  18.                     + " - ");
  19.             // Process the query results
  20.             for (int i = 0; i < qr.records.Length; i++)
  21.             {
  22.                 sforce.sObject con = qr.records[i];
  23.                 string fName = con.Any[0].InnerText;
  24.                 string lName = con.Any[1].InnerText;
  25.                 if (fName == null)
  26.                     Console.WriteLine("Contact " + (i + 1) + ": " + lName);
  27.                 else
  28.                     Console.WriteLine("Contact " + (i + 1) + ": " + fName
  29.                         + " " + lName);
  30.             }
  31.  
  32.             if (qr.done)
  33.                 done = true;
  34.             else
  35.                 qr = binding.queryMore(qr.queryLocator);
  36.         }
  37.     }
  38.     catch (SoapException e)
  39.     {
  40.         Console.WriteLine("An unexpected error has occurred: " + e.Message +
  41.             " Stack trace: " + e.StackTrace);
  42.     }
  43.     Console.WriteLine("nQuery execution completed.");
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top