DQL Data Source Control
| October 2005 | |
Data Source
Data sources are a new concept in the ASP.NET 2.0. They are meant to abstract data providers from data controls in order to minimize the amount of glue code between them. For more information refer to the ASP.NET 2.0 documentation on MSDN.
DQLDataSource
The control acts as a conduit between data controls and Documentum ADO.NET Services (DAS) or the DFC Primary Interop Assembly (PIA). The DQLDataSource control abstracts the DQL query execution logic from data bound controls. It relieves the developer from delving into Documentum-specific code. The control can use Documentum ADO.NET Services (DAS) or the PIA to execute DQL statements. The choice is controlled by a boolean property 'UseDAS' that can be set in the Visual Studio designer.
Features
The control can be dragged-dropped from the toolbox. It needs a connection string and a select query. Both of these can be set programmatically or at design time. Data controls such as GridView can point to the DQL data source control and consume the results from it. This article later discusses a simple query tool that needs minimal code(literally 2 lines of code).
Usage
- Create a new webform in a ASP.NET project.
- Drag the DQLDataSource from the toolbox onto the webform.
- Set the connection string and a select query. The data source does not support update/create queries.
- Drag a data control such as a Grid View from the toolbox. In the DataSource property of the GridView select the DQLDataSource control that you just dragged.
- Execute the webform. You should see the results of the query in the GridView control.
A Simple Query Tool
- Drag a DQLDataSourceControl onto a new webform
- Drag a textbox control and a button
- Drag a GridView control and set its data source property to point to the DQLDataSource control dragged earlier.

Fig - Query Tool - Design View
- In the 'click' event-handler for the button write the following code -
protected void Button1_Click(object sender, EventArgs e)
{
DQLDataSource1.SelectQuery = TextBox1.Text;
GridView1.DataBind();
}
|
- Execute the webform.
- Enter a DQL query into the textbox and click the button. The results of the query will get displayed in the GridView

Fig - Query Tool - Runtime View
|