多线程查询数据时,就报各种莫名其妙的错误,一会报“游标”不存在,一会报“xxx”字段不存在(事实上是存在的),竟然还有这个“Cannot open / define command, which does not return result sets. Hint: use Excecute / ExecSQL method for non-SELECT commands.”。
贴出查询的语句:
function TForm1.GetTheQueryData(const aSQL: String; aQuery: TFDQuery): Boolean; begin Result := False; // EnterCriticalSection(_CSDB); try try if Assigned(aQuery) then begin aQuery.Connection := FDConnection1; aQuery.SQL.Clear; aQuery.SQL.Add(aSQL); aQuery.Open(); Result := True; end; except on E: Exception do // end; finally // LeaveCriticalSection(_CSDB); end; end;