am_jygzs.~pas
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:2k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit am_jygzs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, DB, StdCtrls, Buttons, ExtCtrls, DBCtrlsEh, Mask, DBCtrls;
  6. type
  7.   Tam_jygz = class(TForm)
  8.     Panel1: TPanel;
  9.     SpeedButton1: TSpeedButton;
  10.     SpeedButton2: TSpeedButton;
  11.     Label1: TLabel;
  12.     Label2: TLabel;
  13.     Label3: TLabel;
  14.     Label4: TLabel;
  15.     Label5: TLabel;
  16.     Label6: TLabel;
  17.     DataSource1: TDataSource;
  18.     DBComboBoxEh1: TDBComboBoxEh;
  19.     DBEditEh3: TDBEditEh;
  20.     SpeedButton3: TSpeedButton;
  21.     SpeedButton4: TSpeedButton;
  22.     DBNavigator1: TDBNavigator;
  23.     Label7: TLabel;
  24.     DBNumberEditEh1: TDBNumberEditEh;
  25.     DBNumberEditEh2: TDBNumberEditEh;
  26.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  27.     procedure FormCreate(Sender: TObject);
  28.     procedure SpeedButton1Click(Sender: TObject);
  29.     procedure SpeedButton3Click(Sender: TObject);
  30.     procedure SpeedButton4Click(Sender: TObject);
  31.     procedure SpeedButton2Click(Sender: TObject);
  32.   private
  33.     { Private declarations }
  34.   public
  35.     { Public declarations }
  36.   end;
  37. var
  38.   am_jygz: Tam_jygz;
  39. implementation
  40. uses dms, xt_yhz_ms;
  41. {$R *.dfm}
  42. procedure Tam_jygz.FormClose(Sender: TObject; var Action: TCloseAction);
  43. begin
  44.   action:=cafree;
  45.   am_jygz:=nil;
  46. end;
  47. procedure Tam_jygz.FormCreate(Sender: TObject);
  48. begin
  49.  dm.am_jygl.Active:=false;
  50.  dm.am_jygz.Active:=true;
  51. end;
  52. procedure Tam_jygz.SpeedButton1Click(Sender: TObject);
  53. var i:integer;
  54. begin
  55.    if dbediteh3.Text='' then
  56.     begin
  57.       application.MessageBox('借阅级别不能为空','提示',mb_ok+mb_iconinformation);
  58.     end;
  59.    Dm.am_jygz.ApplyUpdates(0);
  60.    i:=Dm.am_jygz.ApplyUpdates(0);
  61.    if i=0 then
  62.    begin
  63.       application.MessageBox('数据保存成功','提示',mb_ok+mb_iconinformation);
  64.       dm.am_jygz.Close;
  65.       dm.am_jygz.CommandText:='select * from am_jygz';
  66.       dm.am_jygz.Open;
  67.    end
  68.    else
  69.    begin
  70.      application.MessageBox('数据保存失败','提示',mb_ok+mb_iconinformation);
  71.      exit;
  72.    end;
  73. end;
  74. procedure Tam_jygz.SpeedButton3Click(Sender: TObject);
  75. begin
  76.  dm.am_jygz.Append;
  77. end;
  78. procedure Tam_jygz.SpeedButton4Click(Sender: TObject);
  79. begin
  80.  dm.am_jygz.edit;
  81. end;
  82. procedure Tam_jygz.SpeedButton2Click(Sender: TObject);
  83. begin
  84.   close;
  85. end;
  86. end.