X
xw_gao
Unregistered / Unconfirmed
GUEST, unregistred user!
请问为什么我在打开.pas时会把整个delphi(工具)程序都关闭了,而这个.pas是通过编译后,有exe可执行文件可以运行!
unit PassRate;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, PBEdit, LbButton, Grids, DBGridEh, ADODB,Database,
DB, ComCtrls, PBDateTimePicker;
type
TForm1 = class(TForm)
Panel1: TPanel;
Grid: TDBGridEh;
Panel5: TPanel;
Label1: TLabel;
Label3: TLabel;
SelTypeBox: TComboBox;
QueryBtn: TLbButton;
DisqualEdit: TPBEdit;
OkBtn: TLbButton;
CancelBtn: TLbButton;
Panel9: TPanel;
Image1: TImage;
Command: TADOCommand;
Label2: TLabel;
BatchEdit: TPBEdit;
Label4: TLabel;
ReasonEdit: TPBEdit;
Query: TADOQuery;
DataSource: TDataSource;
DateEdit: TPBDateTimePicker;
Label5: TLabel;
procedure OkBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function InsertE42:boolean;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.OkBtnClick(Sender: TObject);
begin
InsertE42;
end;
function TForm1.InsertE42:boolean;
{把SKD,CKD数据插入SKD,CKD表中}
begin
SysDataModule.SysConnection.begin
Trans;
command.CommandText:='INSERT INTO E42合格率表(日期,批次,总批次,不合格批次,总不合格批次,合格率,不合格原因)VALUES'+
'( ate, :Batch, :AllBatch, isqual,:AllDisqual,:Rate,:Reason)';
command.Parameters.ParamByName('Date').Value:=DateToStr(DateEdit.Date);
command.Parameters.ParamByName('Batch').Value :=BatchEdit.text;
command.Parameters.ParamByName('AllBatch').Value:=BatchEdit.text;
command.Parameters.ParamByName('Disqual').Value:=DisqualEdit.text;
command.Parameters.ParamByName('AllDisqual').Value:= DisqualEdit.text;
command.Parameters.ParamByName('Rate').Value:= ReasonEdit.text;
command.Parameters.ParamByName('Reason').Value:=ReasonEdit.text;
Command.Execute;
SysDataModule.SysConnection.CommitTrans;
query.Open;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DateEdit.Date:= Now;
end;
end.
unit PassRate;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, PBEdit, LbButton, Grids, DBGridEh, ADODB,Database,
DB, ComCtrls, PBDateTimePicker;
type
TForm1 = class(TForm)
Panel1: TPanel;
Grid: TDBGridEh;
Panel5: TPanel;
Label1: TLabel;
Label3: TLabel;
SelTypeBox: TComboBox;
QueryBtn: TLbButton;
DisqualEdit: TPBEdit;
OkBtn: TLbButton;
CancelBtn: TLbButton;
Panel9: TPanel;
Image1: TImage;
Command: TADOCommand;
Label2: TLabel;
BatchEdit: TPBEdit;
Label4: TLabel;
ReasonEdit: TPBEdit;
Query: TADOQuery;
DataSource: TDataSource;
DateEdit: TPBDateTimePicker;
Label5: TLabel;
procedure OkBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function InsertE42:boolean;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.OkBtnClick(Sender: TObject);
begin
InsertE42;
end;
function TForm1.InsertE42:boolean;
{把SKD,CKD数据插入SKD,CKD表中}
begin
SysDataModule.SysConnection.begin
Trans;
command.CommandText:='INSERT INTO E42合格率表(日期,批次,总批次,不合格批次,总不合格批次,合格率,不合格原因)VALUES'+
'( ate, :Batch, :AllBatch, isqual,:AllDisqual,:Rate,:Reason)';
command.Parameters.ParamByName('Date').Value:=DateToStr(DateEdit.Date);
command.Parameters.ParamByName('Batch').Value :=BatchEdit.text;
command.Parameters.ParamByName('AllBatch').Value:=BatchEdit.text;
command.Parameters.ParamByName('Disqual').Value:=DisqualEdit.text;
command.Parameters.ParamByName('AllDisqual').Value:= DisqualEdit.text;
command.Parameters.ParamByName('Rate').Value:= ReasonEdit.text;
command.Parameters.ParamByName('Reason').Value:=ReasonEdit.text;
Command.Execute;
SysDataModule.SysConnection.CommitTrans;
query.Open;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DateEdit.Date:= Now;
end;
end.