MDAC 2.5 SDK - Technical Articles


 

Simplified Programming with ADO

Several features in ADO are designed to make your job easier. Just consider that the data access task analogous to "Hello World" now requires only three lines of code!

Commands as Methods

If a command is associated with a connection, the connection automatically acquires a method with the same name. This makes it easier to call stored procedures and queries and to pass parameters to them.

Programming Language Neutral

ADO is an Automation server, so it can be used from languages such as Microsoft® Visual Basic®, Microsoft Visual J++®, Microsoft Visual C++®, VBScript, and JScript®.

Automation defines Variants as its data types, and Variants work well in languages such as Visual Basic, which are not strongly typed. However, if you are writing in C++ or in Java, most operations in the code will require native data types to support the standard library features of the language. In these cases, ADO allows you to convert data between the Variant and native data types when passing arguments.

ADO has extensions designed specifically to support both Java and C++. For C++, a set of interfaces that directly retrieve and set native C types from the underlying OLE DB provider both improves performance and decreases the lines of code required to interact with the ADO interface. 

For Java, ADO extensions include a set of Java classes that extend the ADO interfaces and create notifications interesting to the Java programmer. These extensions expose functions that return Java types. In addition, the extensions are optimized to improve performance. The Java class directly accesses the native data types in the OLE DB rowset object and returns them as Java types without first converting them to or from a Variant.

No Loss of OLE DB Functionality

ADO allows C++ programmers access to the underlying OLE DB interfaces. This means Visual C++ programmers get the best of both worlds. They can use ADO to easily perform the most common tasks and then access the underlying OLE DB interfaces when they need extra performance or more control than ADO provides.