- 3 minutes to read
The ASP.NET MVC Query Builder is an HTML5/JS based control that allows you and your end-users to create and edit SQL queries without manual coding. It provides a rich and convenient interface to visually display all query elements, which simplifies the query construction process for users who are unfamiliar with SQL and its provider-specific dialects.
The Query Builder generates SELECT statements incorporating query clauses for data filtering, grouping, and sorting. You can use these statements to supply data to various data-aware MVC controls (such as the Grid View or Chart Control).
This section contains the following step-by-step tutorials that provide general information about using the ASP.NET MVC Query Builder:
The Query Builder is a data-aware control and requires a valid data connection to obtain database schema information for populating a table list. This connection also enables the Query Builder to generate the resulting query in a proper SQL dialect and automatically resolve table relations based on foreign keys.
You can add specific tables or views to a query using the drag-and-drop operation without manually writing the query string. Enabling the table columns' check boxes includes them in the query result set.
The Query Builder allows you to join multiple tables or views in the same query and specify various join options. This control automatically resolves table relationships if they are defined at the database level. You can also manually construct relationships by connecting the table key fields.
The Query Builder supports various data-related features that allow you to process records obtained from a database:
The Query Builder produces the following query objects:
You can preview the query execution's result at any moment using the built-in Data Preview window, which displays the result set in a tabular form.
The Query Builder also provides the capability to preview the current SELECT statement created using a visual interface.
You can localize the Query Builder using built-in localization mechanisms like in other .NET applications or by substituting particular localization strings programmatically.