Unit5.~pas
资源名称:HIS.rar [点击查看]
上传用户:fjdqny
上传日期:2016-10-26
资源大小:6299k
文件大小:2k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit5;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, Grids, DBGrids, StdCtrls, ExtCtrls, DBCtrls, DB, ADODB;
- type
- TForm5 = class(TForm)
- Label1: TLabel;
- Edit1: TEdit;
- Label2: TLabel;
- Edit2: TEdit;
- Label3: TLabel;
- Edit3: TEdit;
- Label4: TLabel;
- Edit4: TEdit;
- Label5: TLabel;
- Edit5: TEdit;
- Label6: TLabel;
- Edit6: TEdit;
- Button1: TButton;
- Button2: TButton;
- DBGrid1: TDBGrid;
- Button3: TButton;
- Button4: TButton;
- DataSource1: TDataSource;
- ADOQuery1: TADOQuery;
- ADOConnection1: TADOConnection;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form5: TForm5;
- Canno,Patno,Pat,Med,Su,Uprice:Char;
- implementation
- {$R *.dfm}
- procedure TForm5.Button1Click(Sender: TObject);
- begin
- if (Edit1.Text<>'') and (Edit2.text<>'') and (Edit4.text<>'') then
- begin
- // adoquery1.Open;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('insert into tuiyaodan(Canno,Patno,Pat,Med,Su,Uprice) values(:Canno,:Patno,:Pat,:Med,:Su,:Uprice)');
- adoquery1.Parameters.ParamByName('Canno').Value:=Edit1.Text;
- adoquery1.Parameters.ParamByName('Patno').Value:=Edit2.Text;
- adoquery1.Parameters.ParamByName('Pat').Value:=Edit3.Text;
- adoquery1.Parameters.ParamByName('Med').Value:=Edit4.Text;
- adoquery1.Parameters.ParamByName('Su').Value:=strtoint(Edit5.Text);
- adoquery1.Parameters.ParamByName('Uprice').Value:=strtoint(Edit6.Text);
- adoquery1.ExecSQL;
- adoquery1.Close;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('select Med,Su,Uprice from tuiyaodan where Canno='''+edit1.Text+'''');
- adoquery1.Open;
- Edit4.Clear; Edit5.Clear;Edit6.Clear;
- showmessage('数据已经添加成功!');
- end
- else
- if (Edit1.Text='') then
- showmessage('请输入退药号!')
- else
- if (Edit2.Text='') then
- showmessage('请输入病人编号!')
- else
- if (Edit4.Text='') then
- showmessage('请输入药品名称!');
- end;
- procedure TForm5.Button2Click(Sender: TObject);
- begin
- Edit1.Clear; Edit2.Clear;Edit3.Clear;Edit4.Clear; Edit5.Clear;Edit6.Clear;
- end;
- end.