源码:
MainForm.FormCreate:
temp := Connection.open('COM1'); //打开串口
if not temp then temp := Connection.open('COM2');
if not temp then ShowMessage('通讯端口已被占用,请关闭相应的程序');
SendCard := TSendCard.Create;
CardData.GetSafeNum:
SQLStr := 'select Safe_Unit from Control where 1=1';
with ADOQuery1 do //报错
begin
close;
SQL.Clear;
SQL.Add(SQLStr);
end;
qryConnect.Open;
if DM.ADOQuery1.Eof then Result := 0
else
Result := DM.ADOQuery1.FieldValues['Safe_Unit'];