home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************************}
- { }
- { Vita Voom Software }
- { Main.pas unit - Params Demo }
- { }
- { Copyright (c) 1998-2003 Vita Voom Software }
- { ALL RIGHTS RESERVED }
- {*******************************************************************}
- { }
- { Please refer to the Readme.txt file for details. }
- { }
-
- unit Main;
-
- interface
-
- uses
- SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs,
- QStdCtrls, QGrids, QDBGrids, QExtCtrls, DBXpress, FMTBcd, Provider,
- DBClient, DB, SqlExpr;
-
- type
- TfrmDemo = class(TForm)
- DBGrid1: TDBGrid;
- edtSearchStr: TEdit;
- Panel2: TPanel;
- Label3: TLabel;
- btnSearch: TButton;
- dsParams: TDataSource;
- connParams: TSQLConnection;
- sdsParams: TSQLDataSet;
- cdsParams: TClientDataSet;
- dpParams: TDataSetProvider;
- procedure btnSearchClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- frmDemo: TfrmDemo;
-
- implementation
-
- {$R *.xfm}
-
- procedure TfrmDemo.btnSearchClick(Sender: TObject);
- begin
- // The parameter "TypName" is created at design time,
- // but could have been created at runtime with the following code:
- //
- // with Params.CreateParam(ftString, 'type', ptInput) do
- // AsString := edtSearchStr.Text;
- // Open;
- //
- //
- with sdsParams do
- Params[0].AsString := edtSearchStr.Text;
- with cdsParams do
- begin
- if Active then
- Refresh
- else
- Open
- end;
- end;
-
- end.
-
-