A visitor wrote me recently asking how he could get the filename
of an Access database from an ADO Connection to it. In DAO, you
used to be able to use the CurrentDB function to get the name of
the current file, but how do you do it in ADO?
It's actually really easy. With any open Jet Connection object you
can use this syntax to return the full path and filename of the
current data file:
I'm not sure technically what the difference is, but both seem
to work the same. But let's not stop there... there's a lot
more information you can gather from the properties collection.
The objects in the collection will vary based
on the provider you're using. Try this with one of
your Connection objects and you'll be amazed at all the
information, but be careful... it includes username and password
info so be sure not to leave this type of script lying around
on your server.
' Get all the Connection Properties
For I = 0 to cnnTest.Properties.Count - 1
Response.Write cnnTest.Properties(I).Name & ": " _
& cnnTest.Properties(I) & "<br />" & vbCrLf
Next 'I
If you have a tip you would like to submit, please send it to:
webmaster@asp101.com.