# Introduction

Executing a query directly against a data source returns a one-time result set.  A [DataSet](/wirebootstrap/reference/wire.data/wire.data.dataset.md) is a class container that combines a query with a data source.  It executes the query on behalf of consumers and stores the result set internally.  It is then able to listen for changes that affect the query using [Data Events](/wirebootstrap/reference/wire.data/untitled.md).  If the dataset picks up any changes, it will refresh the result set by re-running the updated query in the data service, update its internal result set, and alert consumers of the change.

This "live" connection to data services allows UI components to effectively talk to one another responding to user-interaction automatically without having to code them to explicitly handle events, refresh data, and re-bind their UI.

## Configuration

A dataset constructor simply takes a data source and a query as a parameter.

```javascript
const accountService = new wire.data.DataSource("custom", {
    ServiceRoot: "./account"
});

const query = wire.data.select().from("Users")
    .where().eq("fred", "x");
    
const dataset = new wire.data.DataSet({
    Source: accountService,
    Query: query
});
```

For more on datasets, visit the [DataSet](/wirebootstrap/reference/wire.data/wire.data.dataset.md) reference page.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wirebootstrap.com/wirebootstrap/datasets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
