2007. február 12., hétfő
List of all ALIASES pointing to a SQL server
Problem/Question/Abstract:
For a little tool, I recently needed to get a list of all aliases which point to a SQL db. (I did not want to see those Paradox files).
Answer:
I came up with the following procedure, which I call like this:
GetAliases(ComboBox1.Items)
procedure GetAliases(const AList: TStrings);
var
i: Integer;
Desc: DBDesc;
Buff: array[0..254] of char;
begin
// list all BDE aliases
Session.GetAliasNames(AList);
for i := AList.Count - 1 downto 0 do
begin
StrPCopy(Buff, AList[i]);
Check(DbiGetDatabaseDesc(Buff, @Desc));
// no Paradox, please
if StrPas(Desc.szDBType) = 'STANDARD' then
AList.Delete(i)
end
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése