entergoo.~pas
上传用户:bjkrmsxy
上传日期:2010-01-31
资源大小:9004k
文件大小:1k
源码类别:

百货/超市行业

开发平台:

Delphi

  1. unit entergoo;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, DB, Grids, DBGrids, ExtCtrls, ADODB, StdCtrls;
  6. type
  7.   TenterFrom = class(TForm)
  8.     ADOQuery1: TADOQuery;
  9.     Panel1: TPanel;
  10.     DBGrid1: TDBGrid;
  11.     DataSource1: TDataSource;
  12.     ADOQuery1p_id: TSmallintField;
  13.     ADOQuery1p_name: TWideStringField;
  14.     ADOQuery1p_price: TBCDField;
  15.     ADOQuery1p_unit: TWideStringField;
  16.     ADOQuery1p_type: TSmallintField;
  17.     ADOQuery1p_sale: TSmallintField;
  18.     Button1: TButton;
  19.     Button2: TButton;
  20.     procedure Button1Click(Sender: TObject);
  21.     procedure FormActivate(Sender: TObject);
  22.     procedure Button2Click(Sender: TObject);
  23.   private
  24.     { Private declarations }
  25.   public
  26.     { Public declarations }
  27.   end;
  28. var
  29.   enterFrom: TenterFrom;
  30. implementation
  31. uses datamodule;
  32. {$R *.dfm}
  33. procedure TenterFrom.Button1Click(Sender: TObject);
  34. begin
  35.  if not adoquery1.active then
  36.   adoquery1.open
  37.   else
  38.   adoquery1.close;
  39. end;
  40. procedure TenterFrom.FormActivate(Sender: TObject);
  41. begin
  42.   if not datamodule1.adoconnection1.connected then
  43.     datamodule1.adoconnection1.connected:=true;
  44.   adoquery1.close;
  45.   adoquery1.open;
  46. end;
  47. procedure TenterFrom.Button2Click(Sender: TObject);
  48. begin
  49. adoquery1.close;
  50. datamodule1.adoconnection1.connected:=false;
  51. close;
  52. end;
  53. end.