加入异常处理
try
DataBase1.Connected := true ;
except
on ex:exception do
begin
Application.MessageBox('连接数据服务器失败。' ,'提示' ,MB_ICONWARNING or MB_OK) ;
end ;
end ;
try
DataBase1.Connected := true ;
except
on ex:exception do
begin
Application.MessageBox('连接数据服务器失败。' ,'提示' ,MB_ICONWARNING or MB_OK) ;
end ;
end ;
begin
showmessage('连接正常');
end
else
begin
showmessage('未接通服务器');
end;
database.open
except
showmessage('未接通服务器'');
Applicaton.Ter........
end;
不要在delphi中运行
去掉设计时设置的数据库连接,用代码设置数据库连接,然后加上belllab(bell)
的代码
1)我是用ADO联接。
2)我装过D6的SP1。
结果:正常!!!