Active Query Builder 2 .NET Edition reference
Quick Start Guide for .NET WinForms Edition
  1. Place the QueryBuilder component on the form:

    using ActiveDatabaseSoftware.ActiveQueryBuilder;
    ...
    QueryBuilder queryBuilder1 = new QueryBuilder();
    
  2. Place required metadata and syntax provider components on the form. Define a proper database connection object for the metadata provider:

    OleDbConnection connection = new OleDbConnection();
    connection.ConnectionString = "<your connection string here>";
    
    OLEDBMetadataProvider metadataProvider = new OLEDBMetadataProvider();
    metadataProvider.Connection = connection;
    
    GenericSyntaxProvider syntaxProvider = new GenericSyntaxProvider();
    
  3. Link the components above to the QueryBuilder by setting MetadataProvider and SyntaxProvider properties:

    queryBuilder1.MetadataProvider = metadataProvider;
    queryBuilder1.SyntaxProvider = syntaxProvider;
    
  4. Place the PlainTextSQLBuilder component on the form to get SQL code generated by the QueryBuilder component with formatting. Link it to the QueryBuilder object:

    PlainTextSQLBuilder sqlBuilder = new PlainTextSQLBuilder();
    sqlBuilder.QueryBuilder = queryBuilder1;
    
  5. Add the TextBox or any other text editing component to a form.

  6. Now you should establish connection between SQLBuilder and the TextBox components.
    Enter the following code to Leave event of TextBox component:

    if (textBox1.Modified)
    {
       try
          {
             queryBuilder1.SQL = textBox1.Text;
          }
          catch (Exception ex)
          {
             MessageBox.Show(ex.Message, "Parsing error");
          }
    
       textBox1.Modified = false;
    }
    

     

    Enter the following code to SQLUpdated event of SQLBuilder component:

    textBox1.Text = sqlBuilder.SQL;
    
    

     

  7. Execute the following code to activate Database Schema Tree:
    queryBuilder1.InitializeDatabaseSchemaTree();
    
    

     

  8. That's all! Now you can run your application.

 

 


© Copyright 2005-2012 ActiveDBSoft. All rights reserved.