Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

get all dsn from odbc

Posted on 2001-07-25
5
Medium Priority
?
153 Views
Last Modified: 2010-04-06
names and properties (like database driver).

thanks
0
Comment
Question by:jpcs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 21

Accepted Solution

by:
gemarti earned 200 total points
ID: 6319353
The way I've been going today I'm almost afraid to post but here:

procedure TForm1.Button1Click(Sender: TObject);
var
  Reg: TRegistry;
  Val : TStringList;
  I : Integer;
begin
  Reg := TRegistry.Create;
  Val := TStringList.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\Software\ODBC\ODBC.INI', False)
    then
      begin
        Reg.GetKeyNames(Val);
        For I := 0 to Val.Count - 1 do
          begin
            ListBox1.Items.Add(Val.Strings[i]);
          end;
      end;
  finally
    Reg.CloseKey;
    Reg.Free;
    Val.Free;
    inherited;
  end;

end;
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6319734
Change these two lines to get the System dsn's on the system

   Reg.RootKey := HKEY_LOCAL_MACHINE;
   if Reg.OpenKey('\Software\ODBC\ODBC.INI', False)


BTW you also need to add Registry to the uses clause.
0
 
LVL 1

Expert Comment

by:rootnash
ID: 6321017
add these for the properties....


procedure TForm1.ListBox1Click(Sender: TObject);
var
 Reg: TRegistry;
 Val: TStringList;
 I  : Integer;
 st : string;
begin
 Reg  := TRegistry.Create;
 Val  := TStringList.Create;
 try
   Listbox2.Clear;
   ListBox3.Clear;
   st := ListBox1.Items.Strings[ListBox1.ItemIndex];
   Reg.RootKey := HKEY_CURRENT_USER;
   if Reg.OpenKey('\Software\ODBC\ODBC.INI\'+ st, False) then
     begin
       Reg.GetValueNames(Val);
       For I := 0 to Val.Count - 1 do
         begin
           ListBox2.Items.Add(Val.Strings[i]);
           ListBox3.Items.Add('"'+Reg.ReadString(Val.Strings[I])+'"');
         end;
     end;
 finally
   Reg.CloseKey;
   Reg.Free;
   Val.Free;
   inherited;
 end;
end;


include another 2 listboxes, ListBox2(Name) and ListBox3(Data)
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6842796
Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, in the event new items have been created since this listing was pulled.

http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.11700518.html
http://www.experts-exchange.com/questions/Q.11747200.html
http://www.experts-exchange.com/questions/Q.20092793.html
http://www.experts-exchange.com/questions/Q.20132046.html
http://www.experts-exchange.com/questions/Q.20156965.html
http://www.experts-exchange.com/questions/Q.20174271.html
http://www.experts-exchange.com/questions/Q.20246680.html
http://www.experts-exchange.com/questions/Q.20258192.html


PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6903298
Force-accepted by
Netminder
CS Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question