JotaEme
asked on
Getting the server name from a DSN
Hi all,
How can I get the server name given a SQLServer DSN?
How can I get the database path of an Access DSN?
I suppose that odbc32.dll could help me, but I don't know
the right function to call from my Visual Basic .Net program.
Thanks in advance
How can I get the server name given a SQLServer DSN?
How can I get the database path of an Access DSN?
I suppose that odbc32.dll could help me, but I don't know
the right function to call from my Visual Basic .Net program.
Thanks in advance
ASKER
Hi again,
Thank you very much for the information, nevertheless, I'm
afraid it's not what I need :-(
This code shows the System and User DSNs, and what I want
is to retrieve the SQLServer name given a DSN name.
I already use a piece of code similar to the one
provided by you in order to fill up a combo box, but what
I need is to know which is the server name of the DSN
selected by the user.
If possible, I would also like to know the path of the Access file (in case the DSN represented an Access one).
Best regards
Thank you very much for the information, nevertheless, I'm
afraid it's not what I need :-(
This code shows the System and User DSNs, and what I want
is to retrieve the SQLServer name given a DSN name.
I already use a piece of code similar to the one
provided by you in order to fill up a combo box, but what
I need is to know which is the server name of the DSN
selected by the user.
If possible, I would also like to know the path of the Access file (in case the DSN represented an Access one).
Best regards
Sorry, I sent you the wrong link, it was the next link in the sequence. Here's the sample I meant to send:
http://www.mvps.org/vbnet/index.html?code/system/sqldatasources.htm
This is only a sample and still the native code doesn't show you how to retrieve what you want, but does show you the methods to retrieve the ODBC data sources and obtain some info fromt he registry. With that in mind, you can get to the following Registry areas to get your DB location info:
HKEY_CURRENT_USER\Software \ODBC\ODBC .INI\DSNNA ME\DBQ
Where DSNNAME is the name of the DSN you are looking for.
http://www.mvps.org/vbnet/index.html?code/system/sqldatasources.htm
This is only a sample and still the native code doesn't show you how to retrieve what you want, but does show you the methods to retrieve the ODBC data sources and obtain some info fromt he registry. With that in mind, you can get to the following Registry areas to get your DB location info:
HKEY_CURRENT_USER\Software
Where DSNNAME is the name of the DSN you are looking for.
ASKER
Thanks again,
What you mean is that I have to work with the registry, don't you?.
I have already had a look at the registry, but my concern is: is the registry structure the same regarless your O.S. and the versions of the drivers?
If not, my applications won't work propery in a different O.S. or using a different version of the ODBC drivers, am I wrong?
Bye
What you mean is that I have to work with the registry, don't you?.
I have already had a look at the registry, but my concern is: is the registry structure the same regarless your O.S. and the versions of the drivers?
If not, my applications won't work propery in a different O.S. or using a different version of the ODBC drivers, am I wrong?
Bye
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
JotaEme:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
http://www.mvps.org/vbnet/index.html?code/system/sqldatasources.htm