Unit6.pas
资源名称:HIS.rar [点击查看]
上传用户:fjdqny
上传日期:2016-10-26
资源大小:6299k
文件大小:3k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit6;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, DB, ADODB;
- type
- TForm6 = 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);
- procedure Button3Click(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form6: TForm6;
- Inno,Druno,Stono,Medno,Med,Su:Char;
- implementation
- {$R *.dfm}
- procedure TForm6.Button1Click(Sender: TObject);
- begin
- if (Edit1.Text<>'') and (Edit2.text<>'') and (Edit3.text<>'') and (Edit4.text<>'') then
- begin
- // adoquery1.Open;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('insert into yaofangrukudan(Inno,Druno,Stono,Medno,Med,Su) values(:Inno,:Druno,:Stono,:Medno,:Med,:Su)');
- adoquery1.Parameters.ParamByName('Inno').Value:=Edit1.Text;
- adoquery1.Parameters.ParamByName('Druno').Value:=Edit2.Text;
- adoquery1.Parameters.ParamByName('Stono').Value:=Edit3.Text;
- adoquery1.Parameters.ParamByName('Medno').Value:=Edit4.Text;
- adoquery1.Parameters.ParamByName('Med').Value:=Edit5.Text;
- adoquery1.Parameters.ParamByName('Su').Value:=strtoint(Edit6.Text);
- adoquery1.ExecSQL;
- adoquery1.Close;
- adoquery1.SQL.Clear;
- adoquery1.SQL.Add('select Medno,Med,Su from yaofangrukudan where Inno='''+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 (Edit3.Text='') then
- showmessage('请输入药库编号!')
- else
- if (Edit4.Text='') then
- showmessage('请输入药品编号!');
- end;
- procedure TForm6.Button2Click(Sender: TObject);
- begin
- Edit1.Clear; Edit2.Clear;Edit3.Clear;Edit4.Clear; Edit5.Clear;Edit6.Clear;
- end;
- procedure TForm6.Button3Click(Sender: TObject);
- begin
- if (Edit1.Text='') then
- showmessage('没有入库单号,入库失败!')
- else
- showmessage('入库成功!')
- end;
- procedure TForm6.Button4Click(Sender: TObject);
- begin
- form6.Close;
- end;
- end.