Home

Introduction to ADO

 

ADO Fundamentals

 

Introduction to Databases

A database is a list or a group of lists of objects organized to make the list(s) and its (their) values easy to create and manage. In the computer world, this suggests, rightly, that the list(s) and its(their) values is(are) stored in a machine. Based on this importance, almost every company keeps some type of database, whether it includes its employees, its customers, or the products it sells.

A database is a project that holds one or more lists of items. There can be other issues involved, such as how the data would be made available to the users, what computer(s) would access the data, what types of users would access the database. The database could reside in one computer and used by one person. A database can also be stored in one computer but accessed by different computers on a network. Another database can be created and stored in a server to be accessed through the Internet. These and other related scenarios should be dealt with to create and distribute the database.

Microsoft JET

To make it possible to create computer databases, Microsoft developed various libraries and programming environments. Microsoft JET is a library used to create and manage Microsoft Access types of databases using a language or a programming environment of your choice. This means that the library can be used from either Microsoft Access, another Microsoft development studio, or an environment from another company. To make this possible, you must first obtain the library. In most cases, you should have this library already installed in your computer. If not, it is freely available by downloading from the Microsoft web site. Once there, simply do a search on "Microsoft JET". After downloading it, install it. 

Microsoft ActiveX Data Objects or ADO, is a library used to manage databases. To make it possible, it uses the driver that is part of Microsoft JET.

Microsoft ActiveX Data Object Extensions for Data Definition Language and Security abbreviated ADOX, is an addition to ADO. It can be used to create and manage a database, providing some of the same operations as ADO but also some operations not possible in ADO.

Any computer language or programming environment that wants to use Microsoft JET provides its own means of accessing the library. In fact, it is not unusual to manually write code that takes advantage of Microsoft JET. This is usually how some programmers would create and manage a web database (through Active Server Pages (ASP)). Still, in most cases, and depending on the language you decide to use to create and manage your database, you would need either only an interpreter (which is the case if you plan to use VBScript, JavaScript, or another interpreted language) or a compiler.

Referencing a Library in a .NET Framework

Based on its flexibility, you can use the .NET Framework to create and manage Microsoft JET databases. The .NET Framework is a group of many libraries under one name. When creating a project, you choose what libraries you would use, based on your goal, to perform the necessary tasks. If you are using a visual environment, you can "visually" reference the library. Based on this, to create an application that uses the ADO library, you can add its reference in the Solution Explorer.

Microsoft ADO Ext.

 

Introduction

To get a database, you can either use one that exists already or you can create your own. ADO by itself doesn't provide the means to create a database. To create one, you can use the Microsoft ActiveX Data Objects Extensions for Data Definition Language and Security, abbreviated ADOX. Before using ADOX, you must reference it in your C# project. To do this, on the main menu of Microsoft Visual C#, you can click Project -> Add Reference... As an alternative, in the Solution Explorer, you can right-click the name of the project and click Add References...

In the COM tab of the Add Reference dialog box, locate the Microsoft ADO Ext. 2.8 for DDL and Security:

Adding a Reference to the Microsoft ADO Ext. 2.8 before creating an ADO database

After referencing the library, you can use its classes. The classes of the ADOX library are stored in a namespace named ADOX.

The Catalog Class

To create and manage various objects of a database, the ADOX namespace provides an interface named Catalog and its derived class is named CatalogClass. To use this class, you can first declare its variable. Here is an example:

using System;

public class Program
{
    static int Main()
    {
        ADOX.CatalogClass catDatabase;

        return 0;
    }
}

After declaring the class, you can initialize it using the new operator:

using System;

public class Program
{
    static int Main()
    {
        ADOX.CatalogClass catDatabase;

        catDatabase = new ADOX.CatalogClass();

        return 0;
    }
}
 

Home Copyright © 2007-2013, FunctionX Next