SelectColumnExpression Class
Defines a column in the SELECT statement by the name, alias and source.
Namespace: DevExpress.DataAccess.DataFederation
Assembly: DevExpress.DataAccess.v24.2.dll
Declaration
public class SelectColumnExpression :
INodeSelectExpression,
ISelectExpression,
IAliasedSelectExpression
Remarks
To specify a field in the federated query’s SELECT statement, create a SelectColumnExpression object and add it to the SelectNode.Expressions collection.
Tip
Instead of adding multiple SelectColumnExpression instances to the collection, you can call the Source.From extension method to build a query with a Fluent API.
Example
This code snippet demonstrates how to create a federated data source that uses a filter with a parameter.
Note
The complete sample project How to Create a Federated Data Source at Runtime is available in the DevExpress Examples repository.
using DevExpress.DataAccess.DataFederation;
// ...
FederationDataSource federation = new FederationDataSource();
Source source = new Source("excelSource", CreateExcelDataSource("SalesPerson.xlsx", "Data"));
var sourceNode = new SourceNode(source, "Orders");
var query = new SelectNode(sourceNode)
{
Alias = "excel",
Expressions = {
new SelectColumnExpression(sourceNode, "OrderID"),
new SelectColumnExpression(sourceNode, "OrderDate"),
new SelectColumnExpression(sourceNode, "Sales Person"),
new SelectColumnExpression(sourceNode, "ProductName"),
new SelectColumnExpression(sourceNode, "Extended Price")
},
FilterString = "[Orders.CategoryName] = ?cat",
};
federation.Queries.Add(query);
federation.Fill(new[] {
new DevExpress.DataAccess.Sql.QueryParameter("cat", typeof(string), "Seafood") });
Inheritance
Object
SelectColumnExpression
See Also