View on GitHub

dotnet-eud

.NET Controls End-User Documentation

Using the Query Builder

In the Query Builder dialog, you can add data tables and views to the data source, and select which columns to include. The Query Builder automatically joins the related tables, so all you need to do is drag-and-drop.

DataBinding_QueryDesignerPanes

Add Tables

To add the required tables/views to a data source, double-click the table (or view) or drag-and-drop it from the Tables pane onto the Diagram pane.

DataBinding_QueryDesigner_Drag-And-Drop

Then, select the required columns.

DataBinding_QueryDesigner_SelectColumns

Join Tables

Note that if at least one table has been added to the Diagram pane, the Tables pane highlights tables that have a relationship with any of the recently added tables.

QueryBuilder_HighlightedTables

To join the already added table with an another table, do one of the following.

The Query Builder will display a relationship between tables.

QueryBuilder_JoinedTables

To edit this relation, select it and use its context menu.

QueryBuilder_RelationContextMenu

The following commands are available.

Edit Column Settings

After you have added the tables and selected the required columns, you can change settings for each column in the Grid pane.

QueryBuilder_GridPane

The following settings are available for each column.

Filter Data

To filter data in the Query Builder, click the Filter… button. This will invoke the Filter Editor dialog, which allows you to build filter criteria.

FilterEditorDialog_SqlDataSource

To learn more, see Filter Queries.

Customize SQL Query

[!IMPORTANT] Note that the Query Builder does not allow you to use custom SQL queries by default.

After you add the required tables, you can customize the automatically generated SQL query. To do this, enable the Allow Edit SQL check box and edit the SQL query displayed in the SQL pane.

DataBinding_QueryDesigner_SQLViewCut

For instance, you can add a WHERE clause to the SQL expression.

[!NOTE] Note that if you edit the automatically generated query and uncheck the Allow Edit SQL check box, your changes will be discarded, and the generated query will be restored.

Preview Data

The Query Builder allows you to preview data for the created SQL query. To do this, click the Preview Results… button.

This invokes the Data Preview window containing data returned after executing the query.