home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Database / ejemplos / controlusu / client1.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-05-06  |  1.3 KB  |  69 lines

  1. unit client1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Db, DBTables, StdCtrls,comobj, ExtCtrls, DBCtrls, Grids, DBGrids;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Edit1: TEdit;
  12.     Button1: TButton;
  13.     DataSource1: TDataSource;
  14.     Table1: TTable;
  15.     Label1: TLabel;
  16.     DBGrid1: TDBGrid;
  17.     DBNavigator1: TDBNavigator;
  18.     procedure Button1Click(Sender: TObject);
  19.     procedure FormCreate(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.     controlusu:Variant;
  23.   public
  24.     { Public declarations }
  25.   end;
  26.  
  27. var
  28.   Form1: TForm1;
  29.  
  30. implementation
  31.  
  32. uses client2;
  33.  
  34. {$R *.DFM}
  35.  
  36. procedure TForm1.Button1Click(Sender: TObject);
  37. begin
  38.  table1.active:=false;
  39.  table1.readonly:=false;
  40.  if controlusu.sololectura(edit1.text) = 0 then
  41.  begin
  42.  table1.open;
  43.    if controlusu.busqueda(edit1.text) = 0 then
  44.    begin
  45.      dbgrid1.columns.items[2].visible:=true;
  46.      Application.CreateForm(TForm2, Form2);
  47.      form2.show;
  48.    end
  49.    else
  50.     dbgrid1.columns.items[2].visible:=false;
  51.    end
  52.  else
  53.  begin
  54.    table1.close;
  55.    table1.readonly:=true;
  56.     Table1.open;
  57.  end;
  58. end;
  59.  
  60. procedure TForm1.FormCreate(Sender: TObject);
  61. begin
  62.    controlusu:=CreateOleObject('pserver1.controlusu');
  63. end;
  64.  
  65. end.
  66.  
  67.  
  68.  
  69.