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