ASP 101 - Active Server Pages 101 - Web01
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

Is The User Still There?
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Quick Tips

Find The Properties of an ADO Connection

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:

Response.Write cnnTest.Properties("Data Source Name")


Response.Write cnnTest.Properties("Data Source")

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

Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers