用adoconnection连接远程sql server数据库,程序在初始化时,若远程数据库未启动服务,则程序不能运行,现在想捕捉那个异常,然后显示的提示用户类似如下代码。50分求解。谢谢各位。
try
begin
Adoconnection1.Connected:=True;
end;
except
on EOleException do
begin
showmessage('远程数据库未启动');
exit;
end;
end;
try
begin
Adoconnection1.Connected:=True;
end;
except
on EOleException do
begin
showmessage('远程数据库未启动');
exit;
end;
end;
var
X,Y,Z:Extended;
begin
Y:=3;
Z:=0;
try
begin
X := Y/Z;
edit1.Text:=floattostr(x);
end;
except
on EZeroDivide do
begin
showmessage('ff');
exit;
end;
end;
上面的异常怎么也捕捉不了呢?