Get the Filtered SQL
In the 3th page of AdHoc(when the "Finish" button is visible), the AdHoc.FilteredSQL property has stored the Filtered SQL that was used to generate the query. So we can pick up this property which is a string object, and then save it in any way you want.
For example:
......
//ahMain is an instance of AdHoc class
string myQuery = this.ahMain.FilteredSQL ;
// save the FilteredSQL to session
Session["StoredQuery"] = myQuery;
Retrieve queries
To reload saved FilterSQL statements to retrieve queries, just simply pass the sql to AdHoc component and let AdHoc to parse it by calling AdHoc.ParseSQLStatement(sql) Method.
The code pieces below explains this:
......
// Retrieve the FilteredSQL string that was saved into session before
string myQuery = Session["StoredQuery"];
// Make AdHoc to parse the sql
ahMain.ParseSQLStatement(sql) ;
Notes
For more detail information, you can refer our online demos.