ComponentOne Query 8.0
Easy Implementation of Simple Ad Hoc Query Functionality

Using a C1Query control in DataSource mode allows the developer to add ad hoc query functionality to an application in a very simple and straightforward way, without invoking the schema designer and creating a schema. In fact, ad hoc functionality can be implemented simply by dropping two controls on a form and setting one property. In this case, however, the C1Query engine is restricted to filtering a single recordset. Queries cannot span multiple tables.

Setting the C1Query DataSource property to a valid ADO/OLE DB data source (such as a ComponentOne True DataControl, an ADODC control, or a DataEnvironment command) activates the DataSource mode. Attached C1QueryFrame controls show the selection of fields according to the field structure of the DataSource recordset. Once the user has specified a query in C1QueryFrame controls, calling the C1Query.BuildSQL method will build the corresponding filter condition.

In most cases, you will use DataSource mode in conjunction with filter mode, setting the C1Query.FilterMode to True. If FilterMode=True, C1Query generates an ADO Filter condition in response to a BuildSQL method call. This condition can be retrieved from the C1Query.ClauseWhere property and assigned to the DataSource recordset (or another ADO recordset), thus restricting the set of rows to only those satisfying the query criteria. When FilterMode=True, C1Query uses ADO syntax rules for the Filter property. You can also use the C1Query control with FilterMode=False, in which case it uses regular SQL syntax. Use C1Query in DataSource mode with FilterMode=False if you want to create an SQL statement’s WHERE condition rather than ADO Filter condition. In this case, you can retrieve the resulting WHERE condition from the C1Query.ClauseWhere property, and also, if needed, you can retrieve ORDER BY and GROUP BY clauses from ClauseOrderBy, ClauseGroupBy. Properties SQL, ClauseSelect and ClauseFrom do not have meaningful values in DataSource mode.

Both FilterMode=True and FilterMode=False are enabled in DataSource mode as well as when DataSource is empty (the regular, schema-governed mode of operation of a C1Query control).

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback