Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving list of ODBC Data Sources from Delphi

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi

Is it possible to retrieve the list of ODBC user Data Sources from Delphi ?

 
Hi ,

here is some code..hope it helps

procedure TForm1.GS;
var
i : Integer;
List : TStringList;
Reg : TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
Reg.LazyWrite := false;
Reg.OpenKey('Software\ODBC\ODBC.INI\ODBC Data Sources', false);
List := TStringList.Create;
Reg.GetValueNames(List);
combobox1.Items.Clear;
for i := 0 to List.Count-1 do
begin
combobox1.Items.Add(List.Strings);

end;

Reg.CloseKey;
finally
Reg.Free;
end;

list.free;
end;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top