为了测试我把这个事件的代码砍去了一大截,好像在BitButton里面操作数据库就好会出现异常。
procedure TloginForm.BitBtn2Click(Sender: TObject);
begin
with dataModule.DataModule1.ClientDataSet1 do
begin
close;//每次在这里就出现异常(use step over)
//CommandText:='select * from operator where oprtid='+edit1.Text;
end;
end;
出现的异常:
Project xxxx raised exception class EAccessViolation with message 'zzzzzz'.Process stopped. Use Step or Run to continue.
procedure TloginForm.BitBtn2Click(Sender: TObject);
begin
with dataModule.DataModule1.ClientDataSet1 do
begin
close;//每次在这里就出现异常(use step over)
//CommandText:='select * from operator where oprtid='+edit1.Text;
end;
end;
出现的异常:
Project xxxx raised exception class EAccessViolation with message 'zzzzzz'.Process stopped. Use Step or Run to continue.
begin FreeAndNil(FormX); //FormX 为登陆后的主窗体,还不行就多Free几个窗体
close;//每次在这里就出现异常(use step over)
//CommandText:='select * from operator where oprtid='+edit1.Text;
end;
如果在其他非这主窗体关闭程序时用loginForm.close or Application.Terminate;
if not assigned(dataModule) then
showMessage('xxx');
'我在FormActivate 里面加入下面代码,出现信息框。if not assigned(dataModule1) then
showMessage('xxx');‘dataModule已经创建。上面的EAccessViolation异常到底是什么意思?一般什么时候才会出现?50分,究竟花开那家,我们拭目以待!
我让bitButton事件里面只有这行代码
DataModule1.ClientDataSet1.Active:=true
这也出现异常(执行后按此按钮。去掉后就没有异常了。这是怎么回事?
这个打点都有东西出现呀,怎么会没有创建或已经释放?
这个有关系吗?
dataModule单元有控件DComConnection\ClientDataset。它应该比这个登录页先创建吧?否则的话估计就会出现上面的异常。有什么办法吗?