# Configuring Database Queries

ActiveReports provides a Visual Studio integrated report designer, rich controls to create and modify reports, and interactive report viewers to preview the reports.

## Content

### General

Once you have configured a valid [Database data source](/activereportsnet/docs/v20.1/report-authors/using-report-wizard/configuring-data-source/database-data-source), the next screen allows you to add one or more queries to the database.

![Configure Queries screen](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/configure-database-queries.png)

### Adding and Removing Queries

You can add and remove Queries by using the **Add** and **Remove** buttons below the list on the left side of the screen. At least one query is required to proceed to the next step.

### Configuring Queries

Each query has a **Name** property, which serves as a unique identifier. By default, the first query is named DataSet1, but you can customize this by changing the name in the **Name** field at the top of the panel.

In the main section, you can choose the query type **Text** or **Stored Procedure** and enter the query.

### Dynamic queries

Queries can be made dynamic by using parameters—these are values that can be provided programmatically by your application or interactively by the report user. To insert a parameter into a path expression, click the **Insert parameter...** link below the Query text area. The **Parameters** dialog will appear:

![Select an Existing Parameter or Add a New One](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/configure-database-queries-parameters.png)

Here, you can re-use an existing parameter or create a new one by clicking the **Add** button. The following parameter properties can be configured:

* **Name**: The parameter name used as a reference in query. You’ll need this name to supply its value via code if you choose to do so.
* **Type**: The data type of the parameter. You can select from **Boolean**, **DateTime**, **Integer**, **Float**, and **String**.
* **Testing Value**: The value used at design-time to test the query.
* **Input Source**: Choose **Programmatic** to supply the parameter values via your application code, or **Interactive** to allow report readers to provide the parameter values.

Once you click the **OK** button, the reference to the selected parameter will be inserted into the query. For example, it will be updated to "Select \* from Customers where Country=@country", which filters the data by country using a dynamic value.

### Validating Queries

You can click the **Validate** button to ensure that the query is valid. The popup dialog will either display the **Query was successfully executed** message or show the error dialog where you can check the error details by clicking the **Details >>** button:

![Query Validation Error](https://cdn.mescius.io/document-site-files/images/b298aea2-8cb8-4a0f-be88-4f54aa263ebd/images/configure-database-queries-validation-error.png)

### Next steps

Once you have configured and validated one or more queries, click **Finish >>** to create a report with data binding configured, or click **Next >** to add [a data display control](/activereportsnet/docs/v20.1/report-authors/using-report-wizard/configuring-report-controls).