Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void querySample()
- {
- try
- {
- QueryResult qr = null;
- binding.QueryOptionsValue = new sforce.QueryOptions();
- binding.QueryOptionsValue.batchSize = 250;
- binding.QueryOptionsValue.batchSizeSpecified = true;
- qr = binding.query("SELECT FirstName, LastName FROM Contact");
- bool done = false;
- int loopCount = 0;
- while (!done)
- {
- Console.WriteLine("nRecords in results set " +
- Convert.ToString(loopCount++)
- + " - ");
- // Process the query results
- for (int i = 0; i < qr.records.Length; i++)
- {
- sforce.sObject con = qr.records[i];
- string fName = con.Any[0].InnerText;
- string lName = con.Any[1].InnerText;
- if (fName == null)
- Console.WriteLine("Contact " + (i + 1) + ": " + lName);
- else
- Console.WriteLine("Contact " + (i + 1) + ": " + fName
- + " " + lName);
- }
- if (qr.done)
- done = true;
- else
- qr = binding.queryMore(qr.queryLocator);
- }
- }
- catch (SoapException e)
- {
- Console.WriteLine("An unexpected error has occurred: " + e.Message +
- " Stack trace: " + e.StackTrace);
- }
- Console.WriteLine("nQuery execution completed.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement