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
nikoo.malek1.3927635000918623E12nikoo.malek1.3927635000918623E12 

How access to field from second table in joint statement

I try to join 2 tables in SOQL that I am using in C#. not sure how get the value from second table that is contact table.
This is my query:

SOQL = "select Name,FirstName,LastName,BillingCity,Id, (Select ID, LastName,Title from Contacts) from Account";
        


            queryResult = SfdcBinding.query(SOQL);
         

            if (queryResult.size > 0)
            {

                for (int i = 0; i < queryResult.size; i++)
                {

                    Account acc = (Account)queryResult.records[i];
                    string name = acc.Name;
                    string FirstName = acc.FirstName;
                    string LastName = acc.LastName;
                    string city = acc.BillingCity;
                    string Id = acc.Id;
                 
                                  
                }

how access to ID, LastName,Title from contact table in code?
dev_sfdc1dev_sfdc1


In SOQL query try like this:

Select id,Name,BillingCity,(Select Contact.id,Contact.LastName,Contact.Titile from Account.Contacts) from Account.

 

nikoo.malek1.3927635000918623E12nikoo.malek1.3927635000918623E12
@sfdcdev , I am not sure how to get the value. As I have acces to account field like this:
SOQL = "Select id,Name,BillingCity,(Select Contact.id,Contact.LastName,Contact.Title from Account.Contacts) from Account";

            queryResult = SfdcBinding.query(SOQL);
         

            if (queryResult.size > 0)
            {

                for (int i = 0; i < queryResult.size; i++)
                {

                    Account acc = (Account)queryResult.records[i];
                    string name = acc.Name;
                    string FirstName = acc.FirstName;
                    string LastName = acc.LastName;
                    string city = acc.BillingCity;
                    string Id = acc.Id;

}


But now the acc.FirstName and acc.LastName; that are coming from contact table are Null. How I can get the value from contact Table?