Active Query Builder 2 .NET Edition reference
Init Event (QueryBuilderControl)

Invoked when the component is initialized.
Public Shadows Event Init As System.EventHandler
Dim instance As QueryBuilderControl
Dim handler As System.EventHandler
AddHandler instance.Init, handler
public new event System.EventHandler Init
public: new __event System.EventHandler* Init

The Init event handler must define metadata and syntax providers for the QueryBuilder object.

Metadata provider is necessary when you're going to retrieve metadata from a database. The alternate way to load metadata is to use pre-generated XML file.

Syntax provider determines SQL syntax rules to build and parse queries.

The sender parameter gets reference to the SessionStoreItem object that holds references to the QueryBuilder and the PlainTextSQLBuilder objects. Working with the ASPX view engine this object can be obtained via the QueryBuilderControl.QueryBuilder property.

This event is fired on calling the QB.Web.Application.reconnect JavaScript method call.

            private void QueryBuilderControl1_OnInit(object sender, EventArgs e)
                // Get instance of QueryBuilder
                QueryBuilder queryBuilder = QueryBuilderControl1.QueryBuilder;
                // create an instance of the proper syntax provider for your database server.
                // - use AutoSyntaxProvider if you want to detect your database server automatically
                //   (autodetection works in case of live database connection only)
                // - use ANSI or Universal syntax provider only if you can't find the right syntax
                //   provider for your database server.
                MSSQLSyntaxProvider syntaxProvider = new MSSQLSyntaxProvider();
                queryBuilder.SyntaxProvider = syntaxProvider;
                // =======================================================
                // load database schema using live database connection
                OleDbConnection connection = new OleDbConnection();
                connection.ConnectionString = "<your connection string>";
                OLEDBMetadataProvider metadataProvider = new OLEDBMetadataProvider();
                metadataProvider.Connection = connection;
                queryBuilder.MetadataProvider = metadataProvider;
                // call the RefreshMetadata to retrieve database schema information
                // =======================================================
                // OR load database schema from the pre-generated XML file
                XmlDocument doc = new XmlDocument();
See Also


QueryBuilderControl Class
QueryBuilderControl Members



© Copyright 2005-2012 ActiveDBSoft. All rights reserved.

Send Feedback