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 

SOQL Problem Querying Related Data Using Version 9.0 of Partner WSDL

I am getting the following error:

MALFORMED_QUERY: SOQL statements can't query related data

From the following code:

public DataTable SelectAllContactsFromSFDC(string SFUserId, string UserSessionId, string serverURL)
    {
     DataTable dtData = new DataTable();

     try
       {
        Test.sforce.wsdl.SforceService Binding = sfLogin(UserSessionId, serverURL);

        string sql = "select a.name, a.industry, (select c.lastname, c.leadsource from a.contacts c) from account a limit 100";
        Test.sforce.wsdl.QueryResult qr = Binding.query(sql);
        Test.sforce.wsdl.sObject[] records = qr.records;
                  // snip
            catch (Exception ex)
            {
               // snip
                throw;
            }

            return (dtData);
        }

I am using the partner WSDL version 9.0.

I have tried this SOQL in the sforce explorer and it seems to work fine.

A more simple query of "select a.name, a.industry from account a limit 100" appears to work fine.

Does anyone have a suggestion on how to fix this?

Thank you.
SuperfellSuperfell
You think you're using 9.0 but you're not. double check your code/config.
Scooter429Scooter429
You were absolutely right.  I mindlessly copied an old weblink.  I was using {!API.Partner_Server_URL_70} in the URL instead of {!API.Partner_Server_URL_90}.

Thanks for your help.
Scott