home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 May / CMCD0505.ISO / Software / Shareware / Programare / pgedri / Source / Demos / Params / Main.pas next >
Encoding:
Pascal/Delphi Source File  |  2005-04-01  |  1.9 KB  |  71 lines

  1. {*******************************************************************}
  2. {                                                                   }
  3. {       Vita Voom Software                                          }
  4. {       Main.pas unit - Params Demo                                 }
  5. {                                                                   }
  6. {       Copyright (c) 1998-2003 Vita Voom Software                  }
  7. {       ALL RIGHTS RESERVED                                         }
  8. {*******************************************************************}
  9. {                                                                   }
  10. { Please refer to the Readme.txt file for details.                  }
  11. {                                                                   }
  12.  
  13. unit Main;
  14.  
  15. interface
  16.  
  17. uses
  18.   SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs,
  19.   QStdCtrls, QGrids, QDBGrids, QExtCtrls, DBXpress, FMTBcd, Provider,
  20.   DBClient, DB, SqlExpr;
  21.  
  22. type
  23.   TfrmDemo = class(TForm)
  24.     DBGrid1: TDBGrid;
  25.     edtSearchStr: TEdit;
  26.     Panel2: TPanel;
  27.     Label3: TLabel;
  28.     btnSearch: TButton;
  29.     dsParams: TDataSource;
  30.     connParams: TSQLConnection;
  31.     sdsParams: TSQLDataSet;
  32.     cdsParams: TClientDataSet;
  33.     dpParams: TDataSetProvider;
  34.     procedure btnSearchClick(Sender: TObject);
  35.   private
  36.     { Private declarations }
  37.   public
  38.     { Public declarations }
  39.   end;
  40.  
  41. var
  42.   frmDemo: TfrmDemo;
  43.  
  44. implementation
  45.  
  46. {$R *.xfm}
  47.  
  48. procedure TfrmDemo.btnSearchClick(Sender: TObject);
  49. begin
  50.   // The parameter "TypName" is created at design time,
  51.   // but could have been created at runtime with the following code:
  52.   //
  53.   // with Params.CreateParam(ftString, 'type', ptInput) do
  54.   //   AsString := edtSearchStr.Text;
  55.   //   Open;
  56.   //
  57.   //
  58.   with sdsParams do
  59.     Params[0].AsString := edtSearchStr.Text;
  60.   with cdsParams do
  61.   begin
  62.     if Active then
  63.       Refresh
  64.     else
  65.       Open
  66.   end;    
  67. end;
  68.  
  69. end.
  70.  
  71.