Microsoft Access
  Home arrow Microsoft Access arrow Page 3 - Connecting to Microsoft Access with ADO
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MICROSOFT ACCESS

Connecting to Microsoft Access with ADO
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    2006-04-19

    Table of Contents:
  • Connecting to Microsoft Access with ADO
  • Overview of ActiveX Data Objects
  • Create a UDL file to connect to an MDB file
  • Read the connection string from the file
  • Create a reference to ADO
  • Write code to open and close the ADODB connection to the database

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Connecting to Microsoft Access with ADO - Create a UDL file to connect to an MDB file


    (Page 3 of 6 )

    For ODBC you straight away click on the Control Panel to access ODBC Data Sources in the Administrative tools. However, for ADO you adopt a different procedure. You create what is called a "UDL" file. You need this because it provides you with the mantra to connect to a database, called the connection string, the single most important thing for connectivity.

    It's very easy to create a UDL file. Create an empty text file and save it with some (any) name but save it with the extension UDL. I created a text file adotest.txt and renamed it adotest.udl. Windows may warn you that it may not be usable but you may ignore the warning. When you place your mouse over it, the tool tip tells you it is a Microsoft Data Link file. Right click the file and click on properties; this pops up the window shown in the following picture. It opens with the General tab in view as seen here.

    Click on the Provider tab, one of the important parts of the connection string. This opens up the tabbed window as shown in the next picture. You can see a whole lot of providers, and there are drivers written by many companies that you may not see here. Highlight the Microsoft Jet 4.0 OLE DB Provider and move over to the next tab.

    This brings you to the Connection tab, where you indicate the source of your Jet database. In this case you browse to the location of the mdb file on your machine, perhaps C:/My Documents folder. In my case it is in the samples folder of Office 11  / MS Access 2003. The default permissions are set for Admin as User Name and a blank for the password.

    Now you may test the connection as shown here. The Advanced tab is to configure the access permissions. It is set to share deny none as default, and the All tab lists the details and initialization chosen for this kind of source. It is possible to edit information in this window. The defaults were accepted for this tutorial. This completes the process of creating the UDL file.

    More Microsoft Access Articles
    More By Jayaram Krishnaswamy


       · Yes, that is true coming straight from the vaults of MS. These remain for backward...
       · i'm new person want to use the aplication asp. Can u give me the sample how to...
       · I have created a system DSN called 'ForAsp' for your illustrationI have an IIS...
       · Send me your email, I will send the code.Jay
     

    MICROSOFT ACCESS ARTICLES

    - Linking SQL Express 2005 Tables to MS Access...
    - Working with Access Projects in Access 2007
    - Exploring Access 2007
    - Working with Stored Procedures in an MS Acce...
    - Creating and Using Action Queries
    - Creating Data Access Pages with Charts using...
    - Advanced Ideas using VBA
    - VBA Details
    - Updating Records in MS Access
    - Using ADO`s Record Object with URLs
    - Exporting XML from MS Access 2003
    - Importing XML into MS Access 2003
    - On Using Pass-through Queries in MS Access
    - Distributed Queries in MS Access
    - Configuring a Linked Microsoft Access Server...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT