Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

Getting DSN details at run time using VB6

Given a system DSN, how can I obtain
the specific SQL Server (or other)
database that that has been mapped to ,
from VB at runtime.
0
josereyes
Asked:
josereyes
  • 2
1 Solution
 
rovermCommented:
Use the ODBCTool DLL. Set a reference to it and instantiate it.

D'Mzzl!
RoverM
0
 
josereyesAuthor Commented:
Sorry but ODBCTools hasn't got that feature.

All it has is CreateDSN,GetDataSourceList and GetODBCDriverList.

I want to specify a DSN and get back the
associated driver and database that it
was mapped to - having set it via
Control Panel outside of VB


0
 
gencrossCommented:
You can get this info from the registry.  User DSN's are stored in HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\[DSN Name].

System DSN's are stored in. HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\[DSN Name].

All the info you want is under these keys.





0
 
josereyesAuthor Commented:
Thanks gencross
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now