Salesforce Organization Table not returning any records

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
Mark Lo Chiano
Posts: 3
Joined: Sun 15 Mar 2020 00:27

Salesforce Organization Table not returning any records

Post by Mark Lo Chiano » Fri 01 May 2020 20:08

We are developing an application that needs to read every table in a Salesforce organization. This is quite successful in both reading the structure of the tables (via various system tables) and all of the data records for interesting tables. We automatically check for and eliminate those "extraneous" fields that have definitions in the system tables, but are not really part of the actual table records (for example, if a label is changed in a table....that label is reported as a field in the Sys_Columns table).

However, we are encountering an odd symptom with the "Organization" table. Even after excluding those fields that are not 'real', and also (as an experiment) manually excluding the "Address" field since it is a compound field, we are not getting any query errors. However, the returned data set does not have any information.

Your DemoCenter example is capable of getting the record field data and so is RazorSql. However, both of these take multiple seconds. We extended the connection timeout to over 60 seconds with no joy. At the same time, we are not having any issues with reading other large tables with over 150 Fields and in excess of 600,000 records.

Any thoughts?

Shalex
Site Admin
Posts: 9301
Joined: Thu 14 Aug 2008 12:44

Re: Salesforce Organization Table not returning any records

Post by Shalex » Fri 08 May 2020 16:18

Please try the code:

Code: Select all

    try
    {
        using (var conn = new Devart.Data.Salesforce.SalesforceConnection())
        {
            conn.UserId = "****";
            conn.Password = "****";
            conn.SecurityToken = "****";
            conn.Open();
            var cmd = conn.CreateCommand();
            cmd.CommandText = "SELECT count(*) FROM Organization";
            Console.WriteLine($"The number of rows in Organization is {cmd.ExecuteScalar()}." + Environment.NewLine);

            cmd.CommandText = "SELECT * FROM Organization";
            cmd.CommandTimeout = 0;
            var reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    Console.Write(reader.GetValue(i) + "\t");
                }
                Console.WriteLine();
            }
            Console.WriteLine(Environment.NewLine + "Fetch is finished.");
        }
    }
    catch (Exception ex)
    {
        do
        {
            Console.WriteLine($"{ex.Message} \r\n {ex.StackTrace} \r\n");
            ex = ex.InnerException;
        } while (ex != null);
    }
    Console.ReadKey();
If it doesn't work, specify its output.

Mark Lo Chiano
Posts: 3
Joined: Sun 15 Mar 2020 00:27

Re: Salesforce Organization Table not returning any records

Post by Mark Lo Chiano » Fri 08 May 2020 23:26

Your code sample worked and did return field level information. Thank you. This provides us with a base line to explore what may be happening.

Post Reply