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
Scooter429Scooter429 

Looking for best practice recommendation for accessing data using related queries

Can someone recommend the best practice for accessing data using using related queries and the partner WSDL in C#.  The supplied example (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_relationships.htm) is in Java and appears to use the Enterprise WSDL. 

qr = binding.query("SELECT a.Id, a.Name, (SELECT c.Id, c.firstname, c.lastname FROM a.Contacts c) FROM Account a");
Test.sforce.wsdl.sObject[] records = qr.records;
if (records != null)  
   {
    bool done = false;
    while (!done)
       {
        for (int i = 0; i < records.Length; i++)
            {
            Test.sforce.wsdl.sObject so = records[i];

// snip...

I think the data that I need is in so.Any[2].  My question is what is the best way to get at this information?

Thank you.
SuperfellSuperfell
The XmlElement as so.Any[2] is a element of type QueryResult, you can either manually walk the xml subtree at this point, or use the XmlSerializer support in .NET to have it convert it to a QueryResult for you, there's code floating around on the borads that show how to do this.