DelphiFAQ Home Search:

Getting the installed ADO version

 

comments2 comments. Current rating: 5 stars (1 votes). Leave comments and/ or rate it.

With different versions of MDAC available, it is sometimes good to check whether the latest version is installed. The following function returns the version of the ADO installation:

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;
You don't like the formatting? Check out SourceCoder then!
Content-type: text/html

Comments:

2007-04-12, 08:42:14
pablohar@hotmail.com from Argentina  
THIS IS THE CORRECT CODE
program Adoversion;

{$APPTYPE CONSOLE}

uses
ActiveX,
Variants,
windows,
Comobj,
SysUtils;

function GetADOVersion: string;
var
ADO: OLEVariant;
begin
try
ADO := CreateOLEObject('adodb.connection');
Result := ADO.Version;
ADO:= null;
except
Result := ' No version';
end;
end;
begin
CoInitialize(nil);
Writeln('Ado version ->> ',GetADOVersion);
Readln;
end.
2007-07-30, 07:06:47
[hidden] from Sweden  
rating
The original code is valid for Delphi 5 but I guess that Pablos comment is valid for Delphi 6 and upwards since he's using variants which doesn't exists in D5.

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: