Question
“How do I launch the Query Wizard outside the designer as a stand-alone dialog?”
Solution
The query Wizard can be launched separate from the designer and used to generate SQL as a stand-alone dialog. Start by creating a TdaQueryWizardDialog object and assigning it a SQL object to use. Once the dialog has been used and closed, access the SQL object to obtain the generated SQL code.
Download: LaunchQueryWizardViaCode.zip
Delphi code sample:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
procedure TForm1.Button1Click(Sender: TObject); var lDialog: TdaQueryWizardDialog; begin lDialog := TdaQueryWizardDialog.Create(Application); try lDialog.SQLClass := TdaSQL; lDialog.SQL.Assign(FSQL); lDialog.Initialize; {show form} if (lDialog.ShowModal = mrOK) then begin FSQL.Assign(lDialog.SQL); Memo1.Lines.AddStrings(lDialog.SQL.SQLText); if (lDialog.NextAction = ppnaPreview) then beep; end; finally lDialog.Free; end; end; |