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

Delphi控件源码

开发平台:

Delphi

  1. unit DbxSingleForm;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, DBXpress, Provider, SqlExpr, ToolWin, DBActns,
  6.   ActnList, ComCtrls, DB, DBClient, DBLocal, DBLocalS, ImgList, StdCtrls,
  7.   Grids, DBGrids, DBLocalB, ActnMan, ActnCtrls;
  8. type
  9.   TForm1 = class(TForm)
  10.     SQLConnection1: TSQLConnection;
  11.     SQLClientDataSet1: TSQLClientDataSet;
  12.     SQLMonitor1: TSQLMonitor;
  13.     PageControl1: TPageControl;
  14.     TabSheet1: TTabSheet;
  15.     TabSheet2: TTabSheet;
  16.     ActionToolBar2: TActionToolBar;
  17.     ImageList1: TImageList;
  18.     ActionManager1: TActionManager;
  19.     DataSetFirst1: TDataSetFirst;
  20.     DataSetPrior1: TDataSetPrior;
  21.     DataSetNext1: TDataSetNext;
  22.     DataSetLast1: TDataSetLast;
  23.     DataSetInsert1: TDataSetInsert;
  24.     DataSetDelete1: TDataSetDelete;
  25.     DataSetEdit1: TDataSetEdit;
  26.     DataSetPost1: TDataSetPost;
  27.     DataSetCancel1: TDataSetCancel;
  28.     DataSetRefresh1: TDataSetRefresh;
  29.     DBGrid1: TDBGrid;
  30.     Button1: TButton;
  31.     DataSource1: TDataSource;
  32.     MemoLog: TMemo;
  33.     procedure Button1Click(Sender: TObject);
  34.     procedure FormCreate(Sender: TObject);
  35.     procedure DoUpdate(DataSet: TDataSet);
  36.     procedure SQLMonitor1LogTrace(Sender: TObject; CBInfo: pSQLTRACEDesc);
  37.   private
  38.     { Private declarations }
  39.   public
  40.     { Public declarations }
  41.   end;
  42. var
  43.   Form1: TForm1;
  44. implementation
  45. {$R *.dfm}
  46. procedure TForm1.Button1Click(Sender: TObject);
  47. begin
  48.   MemoLog.Lines := SQLMonitor1.TraceList;
  49. end;
  50. procedure TForm1.FormCreate(Sender: TObject);
  51. begin
  52.   SQLMonitor1.Active := True;
  53.   SQLClientDataSet1.Open;
  54. end;
  55. procedure TForm1.DoUpdate(DataSet: TDataSet);
  56. begin
  57.   // immediately apply local changes to the database
  58.   SQLClientDataSet1.ApplyUpdates(0);
  59. end;
  60. procedure TForm1.SQLMonitor1LogTrace(Sender: TObject;
  61.   CBInfo: pSQLTRACEDesc);
  62. begin
  63.   MemoLog.Lines.Add (CBInfo.pszTrace);
  64. end;
  65. end.