关于打开.pas时出现的问题! ( 积分: 50 )

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'+
'( :Date, :Batch, :AllBatch, :Disqual,: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.
 
请问为什么我在打开.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'+
'( :Date, :Batch, :AllBatch, :Disqual,: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.
 
没弄懂你的意思
 
这个.pas是通过编译后,有exe可执行文件可以运行!
那么在打开.pas时会把整个delphi(工具)程序都关闭了,我从未见过
是不是系统的问题?
 
{$R *.dfm}
一般出现这种问题是.pas对应的窗体文件有问题。
用普通的文本编辑器打开那个对应的窗体文件看看。然后修改掉可能出问题的属性。
 
系统是没有问题的,都能打开其它的*.pas 文件!
 
谢谢"雪鹰"我把*.dfmk中的
....
object Query: TADOQuery
Active = Ture
....
改成:
.....
object Query: TADOQuery
Active = False
....
就能成功打开了,但是还是不明白是怎么一回事!
 
顶部