Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
498 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (2)


Determine ADO and DAO Versions installedFormat this article printer-friendly!Bookmark function is only available for registered users!
GetDAOversion() GetAdoVersion()
Product:
Delphi 5.x (or higher)
Category:
DB-Special Engine
Skill Level:
Scoring:
Last Update:
06/22/2004
Search Keys:
delphi delphi3000 article borland vcl code-snippet DAO ADO GetDaoVersion GetAdoVersion
Times Scored:
3
Visits:
4576
Uploader: Mike Heydon
Company: EOH
Reference: mheydon@eoh.co.za
 
Question/Problem/Abstract:
Function to determine the highest version of DAO installed on the machine. If no DAO is installed then 0.0 is returned. Typical return values are 3.5 or 3.6 for DAO v3.5 and v3.6.

Function to return the current version of ADO installed. A typical return value is 2.7. If ADO is not available then 0.0 is retuened.

Both functions also support a String result function as well.

function GetDaoVersion : double;
function GetDaoVersionStr : string;

function GetAdoVersion : double;
function GetAdoVersionStr : string;
Answer:



// Add to uses clause
uses Math,ComObj;

// ======================================
// Get Highest DAO ver installed
// ======================================

function GetDaoVersion : double;
var sPath : string;
    iError,iResult : integer;
    rDirInfo : TSearchRec;
begin
  iResult := 0;
  sPath := ExtractFileDrive(WindowsDir) +
                           '\Program Files\Common Files\' +
                           'Microsoft Shared\DAO\dao*.dll';

  // Loop thru to find the MAX DLL version on disk
  iError := FindFirst(sPath,faAnyFile,rDirInfo);

   while iError = 0 do begin
     iResult := Max(iResult,StrToIntDef(copy(rDirInfo.Name,4,3),0));
     iError := FindNext(rDirInfo);
     if iError <> 0 then FindClose(rDirInfo);
   end;

   Result := (iResult / 100.0);
end;


function GetDaoVersionStr : string;
begin
  Result := FormatFloat('##0.00',GetDaoVersion);
end;

// =====================
// Get ADO Version
// =====================

function GetAdoVersion : double;
var oADO: OLEVariant;
begin
  try
    oADO := CreateOLEObject('adodb.connection');
    Result := StrToFloat(oADO.Version);
    oADO := Unassigned;
  except
    Result := 0.0;
  end;
end;

function GetAdoVersionStr : string;
begin
  Result := FormatFloat('##0.00',GetAdoVersion);
end;






Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Unknown Identifier
    Yugi GX (Mar 15 2006 7:57AM)

What version of Delphi does it support. I try to compile it but it returns unknown identifier > WindowsDir ?

Respond

RE: WindowsDir()
Mike Heydon (Mar 15 2006 10:51AM)

Sorry, missed that one. It is a function from my general.pas library that returns the Windows Directory "C:\Windows\',"C:\WINNT" etc.

Here is the Code ..  (uses Windows)

// ==========================================
// Get windows directorys
// ==========================================

function WindowsDir : string;
begin
  SetLength(Result,255);
  GetWindowsDirectory(PChar(Result),255);
  SetLength(Result,StrLen(PChar(Result)));
end;

Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
S. Kucherov
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)