Fast Query Builder

I purchased FR4 Pro and understand that Fast Query Builder is included. How do I lauch the Fast Query Builder? I can't find a component or shortcut for it.

Comments

  • gpigpi
    edited 3:32AM
    For example use:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, frxDesgn, frxClass, frxADOComponents, DB, ADODB, fqbClass;
    
    type
      TfqbADOEngine = class(TfqbEngine)
      private
        FADOConnection: TADOConnection;
        FQuery: TADOQuery;
        procedure SetDatabase(Value: TADOConnection);
      public
        constructor Create(AOwner: TComponent); override;
        destructor Destroy; override;
        procedure ReadFieldList(const ATableName: string; var AFieldList: TfqbFieldList);
                       override;
        procedure ReadTableList(ATableList: TStrings); override;
        function ResultDataSet: TDataSet; override;
        procedure SetSQL(const Value: string); override;
      published
        property Database: TADOConnection read FADOConnection write SetDatabase;
      end;
      TForm1 = class(TForm)
        frxReport1: TfrxReport;
        Button1: TButton;
        ADOConnection1: TADOConnection;
        Memo1: TMemo;
        ADOQuery1: TADOQuery;
        procedure Button1Click(Sender: TObject);
        procedure FormShow(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    constructor TfqbADOEngine.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      FQuery := TADOQuery.Create(Self);
    end;
    
    destructor TfqbADOEngine.Destroy;
    begin
      FQuery.Free;
      inherited Destroy;
    end;
    
    procedure TfqbADOEngine.ReadFieldList(const ATableName: string; var AFieldList:
                   TfqbFieldList);
    var
      i: Integer;
      tbl: TADOTable;
      Fields: TFieldDefs;
      tmpField: TfqbField;
    begin
      tbl := TADOTable.Create(Self);
      tbl.Connection := FADOConnection;
      tbl.TableName := ATableName;
      Fields := tbl.FieldDefs;
      try
        try
          tbl.Active := True;
          tmpField:= TfqbField(AFieldList.Add);
          tmpField.FieldName := '*';
          for i := 0 to Fields.Count - 1 do
          begin
            tmpField:= TfqbField(AFieldList.Add);
            tmpField.FieldName := Fields.Items[i].Name;
            tmpField.FieldType := Ord(Fields.Items[i].DataType)
          end
        except
          on E: EADOError do
            begin
              ShowMessage(E.Message);
              Exit
            end
        end
      finally
        tbl.Free
      end
    end;
    
    procedure TfqbADOEngine.ReadTableList(ATableList: TStrings);
    begin
      ATableList.Clear;
      FQuery.Connection.GetTableNames(ATableList, ShowSystemTables);
    end;
    
    function TfqbADOEngine.ResultDataSet: TDataSet;
    begin
      Result := FQuery
    end;
    
    procedure TfqbADOEngine.SetDatabase(Value: TADOConnection);
    begin
      FQuery.Close;
      FADOConnection := Value;
      FQuery.Connection := FADOConnection;
    end;
    
    procedure TfqbADOEngine.SetSQL(const Value: string);
    begin
      FQuery.Close;
      FQuery.SQL.Text := Value;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      fqbDialog: TfqbDialog;
      fqbADOEngine: TfqbADOEngine;
    begin
      fqbDialog := TfqbDialog.Create(nil);
      fqbADOEngine := TfqbADOEngine.Create(nil);
      try
        fqbADOEngine.Database := ADOConnection1;
        fqbDialog.Engine := fqbADOEngine;
        fqbDialog.SchemaInsideSQL :=False;
        if fqbDialog.Execute then
          begin
            Memo1.Lines.Text := fqbDialog.SQL;
            ADOQuery1.SQL.Text := fqbDialog.SQL;
          end  
      finally
        fqbADOEngine.Free;
        fqbDialog.Free;
      end;
    end;
    
    procedure TForm1.FormShow(Sender: TObject);
    begin
         ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + ExtractFilePath(Application.ExeName) + 'demo.mdb';
         ADOConnection1.Open;
    end;
    
    end.
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.