AWS SDK for .NET Documentation
Query Method (queryRequest)
AmazonAmazon.DynamoDBAmazonDynamoDBClientQuery(QueryRequest) Did this page help you?   Yes   No    Tell us about it...

Gets the values of one or more items and its attributes by primary key (composite primary key, only).

Narrow the scope of the query using comparison operators on the RangeKeyValue of the composite key. Use the ScanIndexForward parameter to get results in forward or reverse order by range key.

Declaration Syntax
C#
public QueryResponse Query(
	QueryRequest queryRequest
)
Parameters
queryRequest (QueryRequest)
Container for the necessary parameters to execute the Query service method on AmazonDynamoDB.
Return Value
The response from the Query service method, as returned by AmazonDynamoDB.
Examples

The following example shows how to query items in a table.
Note: the Query operation retrieves items that have the same hash-key. This means that the Query operation is only supported on tables with both a hash- and a range-key.
Note: the RangeKeyCondition for Query is limited to indexable comparisons. These are EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
We will now retrieve all items where the hash-key is "Mark Twain" and the range-key begins with the string "The Adventures".

CopyQuery sample
// Create a client
AmazonDynamoDBClient client = new AmazonDynamoDBClient();

// Define item hash-key to be string value "Mark Twain"
AttributeValue hashKey = new AttributeValue { S = "Mark Twain" };

// Define query condition to search for range-keys that begin with the string "The Adventures"
Condition condition = new Condition();
condition.WithComparisonOperator("BEGINS_WITH");
condition.WithAttributeValueList(new AttributeValue { S = "The Adventures" });

// Define marker variable
Key startKey = null;

do
{
    // Create Query request
    QueryRequest request = new QueryRequest
    {
        TableName = "SampleTable",
        ExclusiveStartKey = startKey,
        HashKeyValue = hashKey,
        RangeKeyCondition = condition
    };

    // Issue request
    QueryResult result = client.Query(request).QueryResult;

    // View all returned items
    List<Dictionary<string, AttributeValue>> items = result.Items;
    foreach (Dictionary<string, AttributeValue> item in items)
    {
        Console.WriteLine("Item:");
        foreach (var keyValuePair in item)
        {
            Console.WriteLine("{0} : S={1}, N={2}, SS=[{3}], NS=[{4}]",
                keyValuePair.Key,
                keyValuePair.Value.S,
                keyValuePair.Value.N,
                string.Join(", ", keyValuePair.Value.SS.ToArray()),
                string.Join(", ", keyValuePair.Value.SS.ToArray()));
        }
    }

    // Set marker variable
    startKey = result.LastEvaluatedKey;
} while (startKey != null);
Exceptions

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)