Title: How to check if the BDE is installed
Question: How to get the BDE version or check if its installed !
Answer:
This function retrieves the struct SysVersion and writes the results also into the stringlist.
uses dbierrs, DBTables;
...
function fDbiGetSysVersion(SysVerList: TStringList): SYSVersion;
var
Month, Day, iHour, iMin, iSec: Word;
Year: SmallInt;
begin
Check(DbiGetSysVersion(Result));
if (SysVerList nil) then
begin
with SysVerList do
begin
Clear;
Add(Format('ENGINE VERSION=%d', [Result.iVersion]));
Add(Format('INTERFACE LEVEL=%d', [Result.iIntfLevel]));
Check(DbiDateDecode(Result.dateVer, Month, Day, Year));
Add(Format('VERSION DATE=%s', [DateToStr(EncodeDate
(Year, Month, Day))]));
Check(DbiTimeDecode(Result.timeVer, iHour, iMin, iSec));
Add(Format('VERSION TIME=%s', [TimeToStr(EncodeTime
(iHour, iMin, iSec div 1000, iSec div 100))]));
end;
end;
end;
The call looks like this:
var hStrList: TStringList;
Ver: SYSVersion;
begin
hStrList:= TStringList.Create;
try Ver := fDbiGetSysVersion(hStrList); except
ShowMessage('BDE not installed !');
end;
ShowMessage(IntToStr(Ver.iVersion));
Memo1.Lines.Assign(hStrList);
hStrList.Destroy;
end;
A possible result that is displayed inside the memo control may look like this:
ENGINE VERSION=500
INTERFACE LEVEL=500
VERSION DATE=09.06.98
VERSION TIME=17:06:13