我用delphi5.0+paradox数据库开发了一个应用系统,在一个输入模块中共有三个,其中前两个模块很正常,但第三个加入后系统立即不正常,而该模块单独可以运

  • 主题发起人 主题发起人 libaoliang
  • 开始时间 开始时间
L

libaoliang

Unregistered / Unconfirmed
GUEST, unregistred user!
我用delphi5.0+paradox数据库开发了一个应用系统,在一个输入模块中共有三个,其中前两个模块很正常,但第三个加入后系统立即不正常,而该模块单独可以运行,请帮我看看好吗?(50分)<br />我用delphi5.0+paradox数据库开发了一个应用系统,在一个输入模块中共有三个,其
中前两个模块很正常,但第三个加入后系统立即不正常,而该模块单独可以运行,请帮
我看看好吗?代码虽然长点,但比较模块化,容易看,
unit Unitinputck;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ImgList, Db, DBTables, ExtCtrls, Grids, DBGrids, StdCtrls, Buttons, Spin,
ComCtrls, ToolWin;

type
Tinputck = class(TForm)
Label2: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Bevel2: TBevel;
Bevel5: TBevel;
Label19: TLabel;
CoolBar1: TCoolBar;
Label1: TLabel;
DateTimePicker1: TDateTimePicker;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
SpinEdit1: TSpinEdit;
SpinEdit2: TSpinEdit;
SpinEdit3: TSpinEdit;
SpinEdit4: TSpinEdit;
SpinEdit5: TSpinEdit;
SpinEdit6: TSpinEdit;
SpinEdit7: TSpinEdit;
SpinEdit8: TSpinEdit;
SpinEdit9: TSpinEdit;
SpinEdit10: TSpinEdit;
SpinEdit11: TSpinEdit;
SpinEdit12: TSpinEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
Panel1: TPanel;
Label59: TLabel;
DataSource1: TDataSource;
DataSource2: TDataSource;
Table1: TTable;
DataSource3: TDataSource;
Table2: TTable;
Table2Bm: TStringField;
Table2Xm: TStringField;
Table3: TTable;
Table3Cpbm: TStringField;
Table3Cpmc: TStringField;
ImageList1: TImageList;
ImageList2: TImageList;
DataSource4: TDataSource;
DataSource5: TDataSource;
DataSource6: TDataSource;
DataSource7: TDataSource;
Table4: TTable;
Table5: TTable;
Table6: TTable;
Table7: TTable;
DBGrid3: TDBGrid;
DBGrid4: TDBGrid;
DBGrid5: TDBGrid;
DBGrid6: TDBGrid;
ComboBox1: TComboBox;
Label28: TLabel;
Label33: TLabel;
Label34: TLabel;
Label35: TLabel;
Label36: TLabel;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Table4Bm: TStringField;
Table4Xm: TStringField;
Table5Bm: TStringField;
Table5Xm: TStringField;
Table6Bm: TStringField;
Table6Xm: TStringField;
Table7Bm: TStringField;
Table7Xm: TStringField;
Bevel1: TBevel;
Bevel3: TBevel;
Bevel4: TBevel;
procedure FormActivate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure BitBtn1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ToolButton1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure SpinEdit1Enter(Sender: TObject);
procedure SpinEdit1Exit(Sender: TObject);
procedure ComboBox1Exit(Sender: TObject);
procedure ComboBox1Enter(Sender: TObject);
procedure Edit3Change(Sender: TObject);
procedure Edit3Enter(Sender: TObject);
procedure Edit3Exit(Sender: TObject);
procedure Edit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit1Change(Sender: TObject);
procedure Edit1Enter(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit5Change(Sender: TObject);
procedure Edit5Enter(Sender: TObject);
procedure Edit5Exit(Sender: TObject);
procedure Edit5KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit7Change(Sender: TObject);
procedure Edit7Enter(Sender: TObject);
procedure Edit7Exit(Sender: TObject);
procedure Edit7KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit7MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit9Change(Sender: TObject);
procedure Edit9Enter(Sender: TObject);
procedure Edit9Exit(Sender: TObject);
procedure Edit9KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Edit9MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit11MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit11Enter(Sender: TObject);
procedure Edit11Exit(Sender: TObject);
procedure Edit11Change(Sender: TObject);
procedure Edit11KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure DBGrid2CellClick(Column: TColumn);
procedure DBGrid1CellClick(Column: TColumn);
procedure DBGrid3CellClick(Column: TColumn);
procedure DBGrid4CellClick(Column: TColumn);
procedure DBGrid5CellClick(Column: TColumn);
procedure DBGrid6CellClick(Column: TColumn);
private
{ Private declarations }
public
{ Public declarations }
end;

var
inputck: Tinputck;

implementation

{$R *.DFM}

procedure Tinputck.FormActivate(Sender: TObject);
begin
datetimepicker1.date:=now;
table1.open;
table2.open;
table3.open;
table4.open;
table5.open;
table6.open;
table7.open;
combobox1.setfocus;
end;

procedure Tinputck.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
perform(wm_nextdlgctl,0,0);
key:=#0;
end;
end;

procedure Tinputck.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=vk_prior then
sendmessage(handle,wm_nextdlgctl,1,0);
if key=vk_next then
if (spinedit1.value=0) or (spinedit2.value=0) or (spinedit1.value&lt;spinedit2.value) then
begin
showmessage('产量或合格数有为0者!或合格数大于产量!');
abort;
end
else
begin
// table1.insertrecord([datetimepicker1.date,combobox1.text,edit4.text,edit2.text,edit6.text,edit8.text,edit10.text,edit12.text,spinedit1.value,spinedit2.value,spinedit3.value,spinedit4.value,spinedit5.value,spinedit6.value,spinedit7.value,spinedit8.value,spinedit9.value,spinedit10.value,spinedit11.value,spinedit12.value]);
table1.FlushBuffers;
spinedit1.value:=0;
spinedit2.value:=0;
spinedit3.value:=0;
spinedit4.value:=0;
spinedit5.value:=0;
spinedit6.value:=0;
spinedit7.value:=0;
spinedit8.value:=0;
spinedit9.value:=0;
spinedit10.value:=0;
spinedit11.value:=0;
spinedit12.value:=0;
combobox1.setFocus;
end;
end;

procedure Tinputck.BitBtn1Click(Sender: TObject);
begin
// table1.insertrecord([datetimepicker1.date,combobox1.text,edit4.text,edit2.text,edit6.text,edit8.text,edit10.text,edit12.text,spinedit1.value,spinedit2.value,spinedit3.value,spinedit4.value,spinedit5.value,spinedit6.value,spinedit7.value,spinedit8.value,spinedit9.value,spinedit10.value,spinedit11.value,spinedit12.value]);
table1.FlushBuffers;
spinedit1.value:=0;
spinedit2.value:=0;
spinedit3.value:=0;
spinedit4.value:=0;
spinedit5.value:=0;
spinedit6.value:=0;
spinedit7.value:=0;
spinedit8.value:=0;
spinedit9.value:=0;
spinedit10.value:=0;
spinedit11.value:=0;
spinedit12.value:=0;
combobox1.setFocus;
end;

procedure Tinputck.FormClose(Sender: TObject; var Action: TCloseAction);
begin
table1.close;
table2.close;
table3.close;
table4.close;
table5.close;
table6.close;
table7.close;
end;

procedure Tinputck.ToolButton1Click(Sender: TObject);
begin
close;
end;

procedure Tinputck.BitBtn2Click(Sender: TObject);
begin
close;
end;

procedure Tinputck.SpinEdit1Enter(Sender: TObject);
begin
(sender as tspinedit).color:=cllime;
end;

procedure Tinputck.SpinEdit1Exit(Sender: TObject);
begin
(sender as tspinedit).color:=clwindow;
end;

procedure Tinputck.ComboBox1Exit(Sender: TObject);
begin
(sender as tcombobox).color:=clwindow;
end;

procedure Tinputck.ComboBox1Enter(Sender: TObject);
begin
(sender as tcombobox).color:=cllime;
sendmessage(combobox1.handle,cb_showdropdown,integer(true),0);
end;

procedure Tinputck.Edit3Change(Sender: TObject);
begin
with table3 do
begin
filter:='cpbm='''+edit3.text+'*''';
filtered:=true;
end;

end;

procedure Tinputck.Edit3Enter(Sender: TObject);
begin
(sender as tedit).color:=cllime;
if edit3.text&lt;&gt;'' then
table3.locate('cpbm',edit3.text,[lopartialkey]);
end;

procedure Tinputck.Edit3Exit(Sender: TObject);
begin
(sender as tedit).color:=clwindow;
if activecontrol&lt;&gt;dbgrid2 then
begin
dbgrid2.visible:=false;
table3.locate('cpbm',edit3.text,[lopartialkey]);
if table3.eof then
begin
dbgrid2.visible:=true;
exit;
end;
if not table3.eof then
begin
edit3.text:=table3.fieldbyname('cpbm').asstring;
edit4.text:=table3.fieldbyname('cpmc').asstring;
end;
end;
end;

procedure Tinputck.Edit3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if edit3.focused then
dbgrid2.visible:=true
else
dbgrid2.visible:=false;
end;

procedure Tinputck.Edit3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if edit3.focused then
dbgrid2.visible:=true
else
dbgrid2.visible:=false;
end;

procedure Tinputck.Edit1Change(Sender: TObject);
begin
with table2 do
begin
filter:='bm='''+edit1.text+'*''';
filtered:=true;
end;
end;

procedure Tinputck.Edit1Enter(Sender: TObject);
begin
(sender as tedit).color:=cllime;
if edit1.text&lt;&gt;'' then
table2.locate('bm',edit1.text,[lopartialkey]);
end;

procedure Tinputck.Edit1Exit(Sender: TObject);
begin
(sender as tedit).color:=clwindow;
if activecontrol&lt;&gt;dbgrid1 then
begin
dbgrid1.visible:=false;
table2.locate('bm',edit1.text,[lopartialkey]);
if table2.eof then
begin
dbgrid1.visible:=true;
exit;
end;
if not table2.eof then
begin
edit1.text:=table2.fieldbyname('bm').asstring;
edit2.text:=table2.fieldbyname('xm').asstring;
end;
end;
end;

procedure Tinputck.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if edit1.focused then
dbgrid1.visible:=true
else
dbgrid1.visible:=false;
end;

procedure Tinputck.Edit1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if edit1.focused then
dbgrid1.visible:=true
else
dbgrid1.visible:=false;
end;

procedure Tinputck.Edit5Change(Sender: TObject);
begin
with table4 do
begin
filter:='bm='''+edit5.text+'*''';
filtered:=true;
end;
end;

procedure Tinputck.Edit5Enter(Sender: TObject);
begin
(sender as tedit).color:=cllime;
if edit5.text&lt;&gt;'' then
table4.locate('bm',edit5.text,[lopartialkey]);
end;

procedure Tinputck.Edit5Exit(Sender: TObject);
begin
(sender as tedit).color:=clwindow;
if activecontrol&lt;&gt;dbgrid3 then
begin
dbgrid3.visible:=false;
table4.locate('bm',edit5.text,[lopartialkey]);
if table4.eof then
begin
dbgrid3.visible:=true;
exit;
end;
if not table4.eof then
begin
edit5.text:=table4.fieldbyname('bm').asstring;
edit6.text:=table4.fieldbyname('xm').asstring;
end;
end;
end;

procedure Tinputck.Edit5KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if edit5.focused then
dbgrid3.visible:=true
else
dbgrid3.visible:=false;
end;

procedure Tinputck.Edit5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if edit5.focused then
dbgrid3.visible:=true
else
dbgrid3.visible:=false;
end;

procedure Tinputck.Edit7Change(Sender: TObject);
begin
with table5 do
begin
filter:='bm='''+edit7.text+'*''';
filtered:=true;
end;
end;

procedure Tinputck.Edit7Enter(Sender: TObject);
begin
(sender as tedit).color:=cllime;
if edit7.text&lt;&gt;'' then
table5.locate('bm',edit7.text,[lopartialkey]);
end;

procedure Tinputck.Edit7Exit(Sender: TObject);
begin
(sender as tedit).color:=clwindow;
if activecontrol&lt;&gt;dbgrid4 then
begin
dbgrid4.visible:=false;
table5.locate('bm',edit7.text,[lopartialkey]);
if table5.eof then
begin
dbgrid4.visible:=true;
exit;
end;
if not table5.eof then
begin
edit7.text:=table5.fieldbyname('bm').asstring;
edit8.text:=table5.fieldbyname('xm').asstring;
end;
end;
end;

procedure Tinputck.Edit7KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if edit7.focused then
dbgrid4.visible:=true
else
dbgrid4.visible:=false;
end;

procedure Tinputck.Edit7MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if edit7.focused then
dbgrid4.visible:=true
else
dbgrid4.visible:=false;
end;

procedure Tinputck.Edit9Change(Sender: TObject);
begin
with table6 do
begin
filter:='cpbm='''+edit9.text+'*''';
filtered:=true;
end;
end;
procedure Tinputck.Edit9Enter(Sender: TObject);
begin
(sender as tedit).color:=cllime;
if edit9.text&lt;&gt;'' then
table6.locate('bm',edit9.text,[lopartialkey]);
end;

procedure Tinputck.Edit9Exit(Sender: TObject);
begin
(sender as tedit).color:=clwindow;
if activecontrol&lt;&gt;dbgrid5 then
begin
dbgrid5.visible:=false;
table6.locate('bm',edit9.text,[lopartialkey]);
if table6.eof then
begin
dbgrid5.visible:=true;
exit;
end;
if not table5.eof then
begin
edit9.text:=table6.fieldbyname('bm').asstring;
edit10.text:=table6.fieldbyname('xm').asstring;
end;
end;
end;

procedure Tinputck.Edit9KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if edit9.focused then
dbgrid5.visible:=true
else
dbgrid5.visible:=false;
end;

procedure Tinputck.Edit9MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if edit9.focused then
dbgrid5.visible:=true
else
dbgrid5.visible:=false;
end;

procedure Tinputck.Edit11MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
if edit11.focused then
dbgrid6.visible:=true
else
dbgrid6.visible:=false;
end;

procedure Tinputck.Edit11Enter(Sender: TObject);
begin
(sender as tedit).color:=cllime;
if edit11.text&lt;&gt;'' then
table7.locate('bm',edit11.text,[lopartialkey]);
end;

procedure Tinputck.Edit11Exit(Sender: TObject);
begin
(sender as tedit).color:=clwindow;
if activecontrol&lt;&gt;dbgrid6 then
begin
dbgrid6.visible:=false;
table7.locate('bm',edit11.text,[lopartialkey]);
if table7.eof then
begin
dbgrid6.visible:=true;
exit;
end;
if not table7.eof then
begin
edit11.text:=table7.fieldbyname('bm').asstring;
edit12.text:=table7.fieldbyname('xm').asstring;
end;
end;

end;

procedure Tinputck.Edit11Change(Sender: TObject);
begin
with table7 do
begin
filter:='bm='''+edit11.text+'*''';
filtered:=true;
end;

end;

procedure Tinputck.Edit11KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if edit11.focused then
dbgrid6.visible:=true
else
dbgrid6.visible:=false;
end;
procedure Tinputck.DBGrid2CellClick(Column: TColumn);
begin
edit3.text:=table3.fieldbyname('cpbm').asstring;
edit4.text:=table3.fieldbyname('cpmc').asstring;
dbgrid2.visible:=false;
end;

procedure Tinputck.DBGrid1CellClick(Column: TColumn);
begin
edit1.text:=table2.fieldbyname('bm').asstring;
edit2.text:=table2.fieldbyname('xm').asstring;
dbgrid1.visible:=false;
end;

procedure Tinputck.DBGrid3CellClick(Column: TColumn);
begin
edit5.text:=table4.fieldbyname('bm').asstring;
edit6.text:=table4.fieldbyname('xm').asstring;
dbgrid3.visible:=false;
end;

procedure Tinputck.DBGrid4CellClick(Column: TColumn);
begin
edit7.text:=table5.fieldbyname('bm').asstring;
edit8.text:=table5.fieldbyname('xm').asstring;
dbgrid4.visible:=false;
end;

procedure Tinputck.DBGrid5CellClick(Column: TColumn);
begin
edit9.text:=table6.fieldbyname('bm').asstring;
edit10.text:=table6.fieldbyname('xm').asstring;
dbgrid5.visible:=false;
end;

procedure Tinputck.DBGrid6CellClick(Column: TColumn);
begin
edit11.text:=table7.fieldbyname('bm').asstring;
edit12.text:=table7.fieldbyname('xm').asstring;
dbgrid6.visible:=false;
end;

end.
 
加上第三个输入模块立即不正常,
而去掉后则完全正常,为什么会有这样的情况?
我的系统已经比较大,在delphi5.0 系统下运行死机,
但编译可以通过,运行也很正常,据说这是一个bug ,不知谁能解释一下!





 
对了,错误提示信息是:
Exception EoutOfResources in Module SCMIS.EXE at 0001c610 参数错误..

其中: scmis.exe 是主文件名,
请各位大侠指点,不要只看不答,
 
各位老大请帮帮忙,现在把该模块去掉也好象不行了,
编译能通过,但执行时提示Exception EoutOfResources
in Module SCMIS.EXE at 0001c610 参数错误..
请问在什么情况下会出现参数错误的提示,
可能发生的原因是什么?
难道没有人遇到过此类问题吗?




 
谢谢pipi.
 
看代码好累,
要不然把程序都贴出来,,
 
你的程序占用的资源太多了,注意:
1、动态产生窗体,只有需要的时候才产生,没用的时候立刻释放。
2、对于一个窗体上的Query,也是在需要的时候才打开,没用的时候就关闭。
 
多人接受答案了。
 
后退
顶部