Active Query Builder for .NET 3.0
Standard way of getting SQL query text
Using the QueryBuilder visual control, you can setup SQL text formatting using the QueryBuilder.SQLFormattingOptions property group and read SQL text from the QueryBuilder.FormattedSQL property.
Alternate way of getting SQL query text
The SQLBuilder or FormattedSQLBuilder objects must be used when you need to get SQL query text. The GetSQL static method of these objects accepts the SubQuery and SQLGenerationOptions/SQLFormattingOptions objects and returns SQL text in the result. The SQLFormattingOptions class is inherited from the SQLGenerationOptions class. Both are used to store SQL generation options, such as the need for quotation all identifiers in query text, the need for fully qualified notation of database object and field names, etc. The SQLFormattingOptions object additionally holds properties to tune formatting of SQL query text (line breaks, indents, word wrapping).
sqlTextEditor1.Text = FormattedSQLBuilder.GetSQL(sqlQuery1.QueryRoot, sqlFormattingOptions1);
In version 2.x and lower, to get the formatted SQL text, you should create an instance of the PlainTextSQLBuilder object and assign a QueryBuilder object to the PlainTextSQLBuilder.QueryBuilder property. After that, you can handle the PlainTextSQLBuilder.SQLUpdated event to get the formatted SQL text.
The links below point to the lists of available properties of AQB.NET 2.0 to set up the formatting:
A set of formatting options for a single query is represented by the SQLBuilderSelectFormat class.