ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data Namespace / QueryDescription Class
Members Example

In This Topic
    QueryDescription Class
    In This Topic
    A QueryDescription object fully describes how a single table in a database or a query layer that is created from one or more database tables (specified by a valid SQL SELECT statement) should be represented as a Table or FeatureClass if the table is spatially enabled.
    Object Model
    QueryDescription ClassSpatialReference Class
    Syntax
    public sealed class QueryDescription : ArcGIS.Core.CoreObjectsBase, System.IDisposable  
    Public NotInheritable Class QueryDescription 
       Inherits ArcGIS.Core.CoreObjectsBase
       Implements System.IDisposable 
    Example
    Create Default QueryDescription for a Database table and obtain the ArcGIS.Core.Data.Table for the QueryDescription
    public async Task DefaultQueryDescription()
    {
        await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
        {
            DatabaseConnectionProperties databaseConnectionProperties = new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer)
            {
                AuthenticationMode = AuthenticationMode.DBMS,
                Instance = "instance",
                Database = "database",
                User = "user",
                Password = "password"
            };
    
            using (Database database = new Database(databaseConnectionProperties))
            {
                QueryDescription queryDescription = database.GetQueryDescription("CUSTOMERS");
    
                using (Table table = database.OpenTable(queryDescription))
                {
                    //use table
                }
            }
        });
    }
    Create QueryDescription from a custom query for a Database table
    public async Task CustomQueryDescription()
    {
        await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
        {
            DatabaseConnectionProperties databaseConnectionProperties = new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer)
            {
                AuthenticationMode = AuthenticationMode.DBMS,
                Instance = "instance",
                Database = "database",
                User = "user",
                Password = "password"
            };
    
            using (Database database = new Database(databaseConnectionProperties))
            {
                QueryDescription queryDescription = database.GetQueryDescription("SELECT OBJECTID, Shape, FACILITYID FROM EmergencyFacility WHERE JURISDICT = 'Municipal'", "MunicipalEmergencyFacilities");
    
                using (Table table = database.OpenTable(queryDescription))
                {
                    // Use the table.
                }
            }
        });
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CoreObjectsBase
          ArcGIS.Core.Data.QueryDescription

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also