我想在系统启动时检测一下ADOCONNECTION的连接情况,在登录窗口的确定按钮下,运行以下程序,却出现如下错误代码,不知何故.但此段代码如在一个ACTION下运行却没有问题.
Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 004F9395 in module 'Project1.exe'. Read of address 00000058'. Process stopped. Use Step or Run to continue.
代码如下:
if (not dm.ADOConnection1.connected) then
begin
try
 try
  dm.adoconnection1.connectionstring:='FILE NAME=adoconn.udl';
  dm.adoconnection1.connected:=true;
 except
  application.Terminate;
 end;
finally
dm.ADOConnection1.Free;
end;
end
else
showmessage('ok!');