function GetADOVersion: Double;
var
ADO: OLEVariant;
begin
try
ADO := CreateOLEObject('adodb.connection');
Result := StrToFloat(ADO.Version);
ADO := Null;
except
Result := 0.0;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
const
ADOVersionNeeded = 2.5;
begin
if GetADOVersion = ADOVersionNeeded then
ShowMessage('Need to install MDAC version 2.7')
else
ShowMessage(Format('ADO Version %n, is OK', [GetADOVersion]));
레지스트리로 하는 방법은 아닙니다.
다음 방법도 참고하세요
Uses ComObj;
function GetADOVersion: Double;
var
ADO: OLEVariant;
begin
try
ADO := CreateOLEObject('adodb.connection');
Result := StrToFloat(ADO.Version);
ADO := Null;
except
Result := 0.0;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
const
ADOVersionNeeded = 2.5;
begin
if GetADOVersion = ADOVersionNeeded then
ShowMessage('Need to install MDAC version 2.7')
else
ShowMessage(Format('ADO Version %n, is OK', [GetADOVersion]));
end;