为什么系统执行后 会死机 重新运行后执行文件会丢掉?急(90分)

Unregistered / Unconfirmed
GUEST, unregistred user!
我做一个统计 程序编好后运行也没有问题 输入数据执行时 死机 重新打开 再运行时
系统会提醒你 不能建立一个执行文件
在adoquery1的SQL语句中 我是这样写的:
select count(*) 个数 from tab
where (tab.编号like:年月)and (tab.姓名=:姓名)and(tab.部门=:部门)
程序如下
var i:integer;
begin
with adoquery1do
begin
close;
Parameters.ParamByName('年月').value:=edit1.text+'%';
Parameters.ParamByName('姓名').value:=edit2.text;
Parameters.ParamByName('部门').value:=edit3.text;
open;
end;
if adoquery1.recordcount>0 then
begin
i:=adoquery1.FieldByName('个数').asinteger;
if (edit2.text='王') and (edit3.text='管理')then
begin
with adotable1do

begin
edit;
FieldByName('字段').asinteger:=i;
end;
end;
end;
 
看看你的project的输出路径是否已经被删除或者移动,再options的directory中,不是记得很具体,
看看delphi中的project或者run下的options
 
首先你的字段用的是中文字段,这个在DELPHI中尤其是ADO中不是个好现象,容易会发生其他
未知错误,建议改为英文字段。
你的‘if adoquery1.recordcount>0 then
begin
i:=adoquery1.FieldByName('个数').asinteger;
if (edit2.text='王') and (edit3.text='管理')then
begin
with adotable1do

begin
edit;
FieldByName('字段').asinteger:=i;
end;
end;
’的结构体有问题,好象只能执行一条记录。没有比如while not table.eofdo
或者 for
什么的判断。
另外你的错误是执行到什么地方出错的,单步调试一下。
 
看看Exe的输出路径正确吗?还是exe没有被释放掉,导致exe不能被覆盖
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
724
import
I
I
回复
0
查看
681
import
I
S
回复
0
查看
828
SUNSTONE的Delphi笔记
S
顶部