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

Returning SQL recordset returns more than SELECT'd fields

Why does a simple SQL SELECT of 3 fields return a complete table recordset?  Appears to return SELECT * FROM table regardless of the selected columns.
For example, this code queries  Contact table and displays results into a ASP.NET data grid.

List<Contact> contacts = new List<Contact>();
//get a list of contacts so the user can select one
QueryResult qr = SforceApi90.query("SELECT Id, Email, Name FROM Contact ORDER BY Email");
if (qr != null)
  for (int i = 0; i < qr.records.Length; i++)
       Contact contact = (Contact)qr.records[i];
       if (contact.Email != null && contact.Email != String.Empty)
  // dgContacts.Columns.
  dgContacts.DataSource = contacts;


Only the 3 fields will be populated with data, but as you're using the enterprise WSDL, the definition of contact is static compile time thing, therefore it has to include all the fields on contact.

Thank you,  Simon, that's helpful.

What are the differences between using the partner.wsdl versus the enterprise.wsdl?  When should I, as a developer, use one of the other?  Can you direct me to some documentation that discussed this in more detail?