473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Viewing machine data source names

Hello all:

I want to present my user with a list of all system data source names
(System DSN) that are defined on his machine that are of type MS Access
(.mdb). However, I am having some trouble figuring out how,
programatically, to get access to the ODBC data sources defined on the
user machine.
Can someone point me in the right direction?

Thanks much,
zdrakec

Aug 14 '06 #1
3 2366

zdrakec wrote:
Hello all:

I want to present my user with a list of all system data source names
(System DSN) that are defined on his machine that are of type MS Access
(.mdb). However, I am having some trouble figuring out how,
programatically, to get access to the ODBC data sources defined on the
user machine.
Can someone point me in the right direction?

Thanks much,
zdrakec
ODBC Data Sources are stored in the Registry. System DSNs are in
HKEY_LOCAL_MACHINE. User DSNs are stored in HKEY_CURRENT_USER (for each
user). From there they are in SOFTWARE\ODBC\ODBC.INI. Look in ODBC Data
Sources for the list, and each in the list will also have a key that
contains the contents of the DSN. Once you find them, it is pretty
obvious how they are stored. And as long as you are comfortable working
with the .NET Registry Class, it's a piece of cake working with them.

Aug 14 '06 #2
Thank you zacks:

As it turns out, yes, I had found a way in the manner you describe;
apparently, I needed to post the question before my brain would start
operating on it. I did:

Dim odbcNames() As String =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(" SOFTWARE\ODBC\ODBC.INI").GetSubKeyNames
If Not odbcNames Is Nothing AndAlso odbcNames.Length 0 Then
For Each s As String In odbcNames
Dim valueNames() As String =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(" SOFTWARE\ODBC\ODBC.INI").OpenSubKey(s).GetValueNam es
If IsInList("FIL", valueNames, True) Then
Dim testVal As String =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(" SOFTWARE\ODBC\ODBC.INI").OpenSubKey(s).GetValue("F IL").ToString
End If
Next
End If

Thanks much,

zdrakec
za***@construction-imaging.com wrote:
zdrakec wrote:
Hello all:

I want to present my user with a list of all system data source names
(System DSN) that are defined on his machine that are of type MS Access
(.mdb). However, I am having some trouble figuring out how,
programatically, to get access to the ODBC data sources defined on the
user machine.
Can someone point me in the right direction?

Thanks much,
zdrakec

ODBC Data Sources are stored in the Registry. System DSNs are in
HKEY_LOCAL_MACHINE. User DSNs are stored in HKEY_CURRENT_USER (for each
user). From there they are in SOFTWARE\ODBC\ODBC.INI. Look in ODBC Data
Sources for the list, and each in the list will also have a key that
contains the contents of the DSN. Once you find them, it is pretty
obvious how they are stored. And as long as you are comfortable working
with the .NET Registry Class, it's a piece of cake working with them.
Aug 14 '06 #3

zdrakec wrote:
Thank you zacks:

As it turns out, yes, I had found a way in the manner you describe;
apparently, I needed to post the question before my brain would start
operating on it. I did:

Dim odbcNames() As String =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(" SOFTWARE\ODBC\ODBC.INI").GetSubKeyNames
If Not odbcNames Is Nothing AndAlso odbcNames.Length 0 Then
For Each s As String In odbcNames
Dim valueNames() As String =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(" SOFTWARE\ODBC\ODBC.INI").OpenSubKey(s).GetValueNam es
If IsInList("FIL", valueNames, True) Then
Dim testVal As String =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(" SOFTWARE\ODBC\ODBC.INI").OpenSubKey(s).GetValue("F IL").ToString
End If
Next
End If

Thanks much,

zdrakec
Just remember that the "ODBS Data Sources" sub key is a special sub key
that does not define a DSN, but contains the current list of DSNs.
za***@construction-imaging.com wrote:
zdrakec wrote:
Hello all:
>
I want to present my user with a list of all system data source names
(System DSN) that are defined on his machine that are of type MS Access
(.mdb). However, I am having some trouble figuring out how,
programatically, to get access to the ODBC data sources defined on the
user machine.
Can someone point me in the right direction?
>
Thanks much,
zdrakec
ODBC Data Sources are stored in the Registry. System DSNs are in
HKEY_LOCAL_MACHINE. User DSNs are stored in HKEY_CURRENT_USER (for each
user). From there they are in SOFTWARE\ODBC\ODBC.INI. Look in ODBC Data
Sources for the list, and each in the list will also have a key that
contains the contents of the DSN. Once you find them, it is pretty
obvious how they are stored. And as long as you are comfortable working
with the .NET Registry Class, it's a piece of cake working with them.
Aug 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this...
1
by: Brian | last post by:
Greetings all! I've been searching and searching for about two hours looking for advise, help, tips for viewing an Outlook calendar (any view, month, week, day) from within Access. I've noticed...
29
by: Tola | last post by:
In my case of study, my teacher gave me a project, after I analysed the problem I found that I had to used open the file on the other machine? Please help? Thank you in advance. Tola CHROUK
11
by: Reshat Sabiq | last post by:
Hi, I'm currently doing most of my development in Java. The only reason i'm considering alternatives is because Java is decompilable, and thus one's source code is unprotected for the most part...
10
by: David Lee Conley | last post by:
When I open the Data Sources window and create a new data source, everything works fine. But if I have a form showing in the IDE, the Data Sources window becomes disabled and doesn't display any...
7
by: D. Patrick | last post by:
I need to duplicate the functionality of a java applet, and how it connects to a remote server. But, I don't have the protocol information or the java source code which was written years ago. ...
0
by: David P. Donahue | last post by:
This is the first time I've had any problems viewing a report in any of my applications, so I'm not sure where to begin. But when I try to render my report in a report viewer, the application...
3
by: tom.youdan | last post by:
Hi, I have created a database that is used to store contact information for NGO's accross India. It is simple in structure and I want a portion of the data to be viewable on the Internet. I...
1
by: steven_nospam at Yahoo! Canada | last post by:
I am a UNIX person (not much experience with MS Access) who during a recent upgrade on an IBM RS/6000 server had to convert our system due to an upgrade to a new software revision. The old...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.