Skip to main content

Obtaining and Saving the Resulting Query

When an end-user clicks the Save command on the Query Builder control’s toolbar or the client-side Save method is called, the server-side ASPxQueryBuilder.SaveQuery event occurs. A handler receives an event argument providing access to a string containing the resulting query both as a string value and an internal representation speciffic for the DevExpress Data Access library (a SelectQuery object).

using DevExpress.DataAccess.Sql;
// ..
protected void ASPxQueryBuilder1_SaveQuery(object sender, DevExpress.XtraReports.Web.SaveQueryEventArgs e) {
    SelectQuery query = e.ResultQuery;
    string queryString = e.SelectStatement;
}

Note that a SelectQuery can be reopened in the Query Builder for further editing.

protected void Page_Load(object sender, EventArgs e) {
    ASPxQueryBuilder1.OpenConnection("NorthwindXpo", query);            
}