SqlDataSource.Queries Property
Provides access to the collection of queries defined for the SqlDataSource.
Namespace: DevExpress.DataAccess.Sql
Assembly: DevExpress.DataAccess.v24.2.dll
Declaration
[LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)]
public SqlQueryCollection Queries { get; }
Property Value
Type | Description |
---|---|
SqlQueryCollection | A SqlQueryCollection object. |
Remarks
The code sample below demonstrates how to create a custom query and add it to the Queries collection.
using DevExpress.DataAccess;
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Sql;
// ...
private SqlDataSource BindToData() {
// Create a data source with the required connection parameters.
Access97ConnectionParameters connectionParameters =
new Access97ConnectionParameters("../../Data/nwind.mdb", "", "");
SqlDataSource ds = new SqlDataSource(connectionParameters);
// Create an SQL query to access the Products table.
CustomSqlQuery query = new CustomSqlQuery();
query.Name = "customQuery1";
query.Sql = "SELECT * FROM Products";
// Add the created query to the collection.
ds.Queries.Add(query);
return ds;
}
Note that queries are executed in the order they have in the Queries collection.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Queries property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.