home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d5 / CSDBPACK.ZIP / sample / testbrowse.pas < prev    next >
Pascal/Delphi Source File  |  2001-12-21  |  2KB  |  67 lines

  1. unit testbrowse;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   CSDBBrowse, StdCtrls, Db, ADODB, DBTables;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     CSDBBrowse1: TCSDBBrowse;
  12.     DataSource1: TDataSource;
  13.     Button1: TButton;
  14.     Query1: TQuery;
  15.     procedure Button1Click(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.DFM}
  28.  
  29. procedure TForm1.Button1Click(Sender: TObject);
  30. var i:integer;
  31. begin
  32.   with CSDBBrowse1.Param do begin
  33.        Clear;
  34.        TableName:='customer';
  35.        Key.Add('CustNo');
  36.        MultipleSelect:=True;
  37.  
  38.        // change first column title for first displaystr
  39.        TitleStr.Add('Customer No|Company Name|Address1|Address2');
  40.  
  41.        // note that the line below is not mandatory, try remove the comments
  42.        // and see the difference by selecting the second display
  43.        // TitleStr.Add('Customer No|Country|City|State|Last Invoice Date');
  44.  
  45.        IndexName.Add('Customer No');
  46.        IndexName.Add('Country, City, State');
  47.        IndexName.Add('Last Invoice Date');
  48.  
  49.        IndexStr.Add('custno');
  50.        IndexStr.Add('country, city, state');
  51.        IndexStr.Add('lastinvoicedate');
  52.  
  53.        DisplayName.Add('Default long display'); // show all fields
  54.        DisplayName.Add('Short display'); // show only few fields
  55.        DisplayStr.Add('*'); // show all fields
  56.        DisplayStr.Add('custno, country, city, state, lastinvoicedate'); // show only few fields
  57.  
  58.        CSDBBrowse1.Execute;
  59.  
  60.        for i:=0 to ResultStr.Count-1 do
  61.           ShowMessage('Selected customer no:' + ResultStr.Strings[i]);
  62.  
  63.   end;
  64.  
  65. end;
  66. end.
  67.