Mega Code Archive

 
Categories / Delphi / Examples
 

List of all aliases pointing to a sql server

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). 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;