x.close;
x.CommandText :=
'select * from a where 1=2';
try
x.Open;
except
on E: Exception do
begin
if E.Message = '网络连接异常' then
begin
DialogInformation(EXCEPTMESSAGE);
exit;
end;
end;
end;
ShowProgressDlg('no', 'nono', crsbillCheckedCount);
说白了,“1=2”永远不满足,所以查不到数据,这句话的作用在这里就是为了判断网络通不通,服务器有没有连接上,
一般情况下,“select * from table where 1=2”就扮演着这种角色。
我悟了。