Skip to main content

CustomSqlQuery Class

A custom query.

Namespace: DevExpress.DataAccess.Sql

Assembly: DevExpress.DataAccess.v24.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

public sealed class CustomSqlQuery :
    SqlQuery

Remarks

The code sample below demonstrates how to create a CustomSqlQuery that selects all the elements of all the rows of a table.

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";

    ds.Queries.Add(query);
    ds.Fill();
    return ds;
}

Note

Any parameters passed to a CustomSqlQuery should not be multi-value parameters.

Inheritance

Object
SqlQuery
CustomSqlQuery
See Also