2007. szeptember 5., szerda

Retrieve a list of available BDE language drivers


Problem/Question/Abstract:

How can I retrieve a list of available BDE language drivers?  

Answer:

The following Delphi procedure returns a formatted list of available BDE language drivers. The procedure can be called as shown in the buttonclick method below.

Add BDE and DBTables to your unit's uses clause.

procedure GetLdList(Lines: TStrings);
var
  hCur: hDBICur;
  LD: LDDesc;
  cnt: integer;
begin
  // get a cursor to the in-mem table containing language
  // driver information...
  cnt := 0;
  check(dbiinit(nil));
  Check(DbiOpenLdList(hCur));
  try
    while (DbiGetNextRecord(hCur, dbiNOLOCK, @LD, nil) = DBIERR_NONE) do
    begin
      cnt := cnt + ;
      Lines.Add(format('%4d %-6s%- 0s %- 0s%5s %- 0s %- 0s', [cnt, 'Name:', LD.szName,
        'Code Page:', IntToStr(LD.iCodePage), 'Description:', LD.szDesc]));
    end;
  finally Check(DbiCloseCursor(hCur));
    check(dbiexit);
  end;
end;

procedure TForm.Button Click(Sender: TObject);
begin
  getldlist(memo.lines);
end;

end.

Nincsenek megjegyzések:

Megjegyzés küldése