to YYXX: 应该不存在用不了的问题. 以下是我做试验的线程代码,可以使用,无问题.
type
TConnThread=class(TThread)
private
FConnection:TADOConnection;
protected
procedure Execute;override;
public
constructor Create(AConn:TADOConnection);
destructor Destroy;override;
end;
implementation
constructor TConnThread.Create(AConn: TADOConnection);
begin
inherited Create(True);
FConnection:=AConn;
FreeOnTerminate:=True;
Resume;
end;
destructor TConnThread.Destroy;
begin
inherited;
end;
procedure TConnThread.Execute;
begin
CoInitialize(nil);
try
FConnection.Open;
finally
CoUninitialize;
end;
end;