I'm sorry that link does appear to be broken now. Here is the function that I created based on the information from that link. It retrieves the information from the registry. I hope this helps you.
This function fills a ComboBox with a list of ODBC DSNs availiable on the system. It should get the User DSNs and the System DSNs. You need to include the 'Registry' Unit in the Uses section.
procedure TLoginPrompt.GetDSNList;
var
aStringList : TStringlist;
aStrings1 : TStrings;
aStrings2 : Tstrings;
aRegistry : TRegistry;
aInt : Integer;
tempInt : Integer;
Begin
aStringlist:=TStringlist.Create;
aStrings1:=TStringlist.Create;
aStrings2:=TStringlist.Create;
aRegistry:= Tregistry.Create;
With aRegistry do Begin
RootKey:=HKEY_CURRENT_USER;
OpenKey('Software\ODBC\ODBC.INI\ODBC Data Sources',False);
GetValueNames(aStrings1);
End;
aRegistry.Free;
aRegistry:= Tregistry.Create;
With aRegistry do Begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('Software\ODBC\ODBC.INI\ODBC Data Sources',False);
GetValueNames(aStrings2);
End;
aRegistry.Free;
aStringlist.AddStrings(aStrings1);
aStrings1.Free;
aStringlist.AddStrings(aStrings2);
aStrings2.Free;
aStringlist.Sort;
ComboBox1.Clear;
tempInt := 0;
for aInt:=0 to aStringList.Count-1 do begin
if Trim(aStringList[aInt]) <> '' then begin
ComboBox1.Items.Add(Trim(aStringList[aInt]));
INC(tempInt);
end;
end;
End;