FreeQueryForm.pas
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit FreeQueryForm;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   DBCtrls, StdCtrls, ExtCtrls, Grids, DBGrids, IBDatabase, Db,
  6.   IBCustomDataSet, IBQuery;
  7. type
  8.   TFormFreeQuery = class(TForm)
  9.     MemoSql: TMemo;
  10.     Splitter1: TSplitter;
  11.     DBGrid1: TDBGrid;
  12.     Panel1: TPanel;
  13.     ButtonRun: TButton;
  14.     DBNavigator1: TDBNavigator;
  15.     dsQueryFree: TDataSource;
  16.     QueryFree: TIBQuery;
  17.     IBTransaction1: TIBTransaction;
  18.     ComboTables: TComboBox;
  19.     procedure ButtonRunClick(Sender: TObject);
  20.     procedure FormCreate(Sender: TObject);
  21.     procedure ComboTablesChange(Sender: TObject);
  22.   private
  23.     { Private declarations }
  24.   public
  25.     { Public declarations }
  26.   end;
  27. var
  28.   FormFreeQuery: TFormFreeQuery;
  29. implementation
  30. uses MainData;
  31. {$R *.DFM}
  32. procedure TFormFreeQuery.ButtonRunClick(Sender: TObject);
  33. begin
  34.   QueryFree.Close;
  35.   QueryFree.SQL := MemoSql.Lines;
  36.   QueryFree.Open;
  37. end;
  38. procedure TFormFreeQuery.FormCreate(Sender: TObject);
  39. begin
  40.   DmMain.IBDatabase1.GetTableNames (ComboTables.Items);
  41. end;
  42. procedure TFormFreeQuery.ComboTablesChange(Sender: TObject);
  43. begin
  44.   MemoSql.Lines.Text :=
  45.     'select * from ' + ComboTables.Text;
  46. end;
  47. end.