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



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
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

QUICK TIP:
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")

or

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: webmaster@asp101.com.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

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