Export (0) Print
Expand All

CloudTableQuery.Execute Method ()

Updated: April 24, 2013

[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See Storage Client Library for the latest version.]

Executes the query with the retry policy specified on the CloudTableQuery object.

Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)

Dim instance As CloudTableQuery(Of TElement)
Dim returnValue As IEnumerable(Of TElement)

returnValue = instance.Execute

IEnumerable<TElement>^ Execute ()

Return Value

Type: System.Collections.Generic.IEnumerable

The query result.

The following code example creates and executes a query against a table.

public static void ExecuteQuery(CloudStorageAccount storageAccount)
    // Create the service context.
    TableServiceContext context = new TableServiceContext(storageAccount.TableEndpoint.ToString(),

    // Execute the query and write out some data.
    foreach (var entity in context.CreateQuery<ProductEntity>("Products").AsTableServiceQuery<ProductEntity>().Execute())
        Console.WriteLine("Product name: {0} Price: {1}", entity.ProductName, entity.Price);

    // Execute the query with criteria that simulates a LIKE clause.
    foreach (var entity in context.CreateQuery<ProductEntity>("Products")
        .Where(e => (e.ProductName.CompareTo("J") >= 0 && e.ProductName.CompareTo("K") < 0))
        Console.WriteLine("Product name: {0} Price: {1}", entity.ProductName, entity.Price);

// Define a class that represents an entity.
class ProductEntity : TableServiceEntity
    public ProductEntity()

    public string ProductName { get; set; }
    public string Category { get; set; }
    public double Price { get; set; }
    public bool InStock { get; set; }
    public DateTime DateAdded { get; set; }
    public Int32 Quantity { get; set; }

Calling the Execute method retrieves results lazily from the service.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012


© 2014 Microsoft