473,836 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2401

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_MACH INE. User DSNs are stored in HKEY_CURRENT_US ER (for each
user). From there they are in SOFTWARE\ODBC\O DBC.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.Local Machine.OpenSub Key("SOFTWARE\O DBC\ODBC.INI"). GetSubKeyNames
If Not odbcNames Is Nothing AndAlso odbcNames.Lengt h 0 Then
For Each s As String In odbcNames
Dim valueNames() As String =
Microsoft.Win32 .Registry.Local Machine.OpenSub Key("SOFTWARE\O DBC\ODBC.INI"). OpenSubKey(s).G etValueNames
If IsInList("FIL", valueNames, True) Then
Dim testVal As String =
Microsoft.Win32 .Registry.Local Machine.OpenSub Key("SOFTWARE\O DBC\ODBC.INI"). OpenSubKey(s).G etValue("FIL"). ToString
End If
Next
End If

Thanks much,

zdrakec
za***@construct ion-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_MACH INE. User DSNs are stored in HKEY_CURRENT_US ER (for each
user). From there they are in SOFTWARE\ODBC\O DBC.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.Local Machine.OpenSub Key("SOFTWARE\O DBC\ODBC.INI"). GetSubKeyNames
If Not odbcNames Is Nothing AndAlso odbcNames.Lengt h 0 Then
For Each s As String In odbcNames
Dim valueNames() As String =
Microsoft.Win32 .Registry.Local Machine.OpenSub Key("SOFTWARE\O DBC\ODBC.INI"). OpenSubKey(s).G etValueNames
If IsInList("FIL", valueNames, True) Then
Dim testVal As String =
Microsoft.Win32 .Registry.Local Machine.OpenSub Key("SOFTWARE\O DBC\ODBC.INI"). OpenSubKey(s).G etValue("FIL"). 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***@construct ion-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_MACH INE. User DSNs are stored in HKEY_CURRENT_US ER (for each
user). From there they are in SOFTWARE\ODBC\O DBC.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
9207
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 will work for 9i and even 10g ) No one had what I needed, so I wrote it myself. I Rule. This code isn't going for efficiency, and isn't trying to be dynamic. It doesn't create the table structure in Oracle, that's up to you. (I
1
2008
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 that linking the Outlook folder is easy, but the link doesn't include the appointment data, i.e. start time, end time, etc. Am I barking up a dead tree? Any help would be greatly appreciated. Thanks in advance
29
3414
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
2405
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 when shipped as a desktop app (obfuscation is good, but i'd like it to be more secure). Thus, i'm considering alternatives for Desktop apps. Do i understand correctly that C# .NET can always be
10
1543
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 of the database components. Yet, when I switch to code view, I can see everything just fine. Does anyone have any idea why the Data Sources window becomes disabled when I'm viewing forms? TIA.
7
2688
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. So, I used a packet sniffer and saw the protocol (TCP), the port, IP address, etc. All is good. I tried 2 different versions of .NET code to duplicate the requests to the remote server. Again, I used the packet sniffer and my packets seemed...
0
3119
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 throws the output at the end of this message. My question, I guess, is what is this Keycode it's talking about? ----------BEGIN PASTE---------- See the end of this message for details on invoking
3
1714
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 want the information to be available for read access only. What is the potential for using Data Access pages for this task and what are the key questions/technologies I need to address before I can
1
5541
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 software was ISAM-based and relied on a product called Transoft U/SQL to create "simulated" ODBC connections to the data for querying and reporting. The new software is using an Informix RDBMS, and so the ODBC driver must be flipped to use the Informix...
0
9657
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10532
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10577
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4443
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3103
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.