Click to See Complete Forum and Search --> : extracting databasename from the configured dsn


deva
February 19th, 1999, 02:41 AM
For a particular dsn how to extract the database name with path to which it is

configured.(Access database)?

basu
November 22nd, 2001, 02:56 AM
If you kindly tell me what excatly you want. I think I can help you out...

By giving configured DSN name you can get the the path of the database..using a library function

regards

Zurg
November 27th, 2001, 09:00 AM
Hi,

If you are talking about a .dsn file, it is easy.
You can access .dsn file like a INI file using the corresponding API's.
Below an example:

Dim Ret as string, NC as Long
'Create a buffer
Ret = string(255, 0)
'Retrieve the string
NC = GetPrivateProfileString("ODBC", "DBQ", "Default", Ret, 255, "C:\test.dsn")
'NC is the number of characters copied to the buffer
If NC <> 0 then Ret = Left$(Ret, NC)
'Show our string
MsgBox Ret