Using AlphaDAO with Xbasic

What is AlphaDAO?

AlphaDAO provides Xbasic program access to SQL databases such as  Microsoft SQL Server, Oracle, MySQL, and Microsoft Access. This functionality extends the familiar Alpha Five database features that previously supported only .DBF files.

Note : While not a part of AlphaDAO, it is important to note that you may also read SQL database data by creating passive-link tables. You may then browse these tables and make updates, open a form or report, and perform Xbasic commands.

Terminology

This document refers to SQL databases and tables as "back-end" databases and tables, and to Alpha Five tables as local tables.

Goal of this Document

This document provides a few short examples showing how you can use AlphaDAO in your Xbasic scripts. In the examples that follow we will often show more than one way to achieve the desired goal.

Following the Examples

All of the examples in this document can be followed from Alpha Five's Interactive window, or by creating Xbasic scripts. The examples all use the Alphasports.MDB Microsoft Access database. This database ships with Alpha Five V8 and is located in the c:\Program Files\A5V8\MDBFiles folder. If you want to work with data in a different database, the concepts learned from the example here will still apply to your database. In this document, the code that you should type in the Interactive window, or into your scripts, is shown in blue like this:

conn.close()

The AlphaDAO Objects

AlphaDAO comprises many objects. You will use their properties and methods when you do your programming. Some of these objects are reserved for use by Alpha Software's development engineers. At least 90 percent of the time, you will find that you need only use 4 objects to build your applications.

This tutorial will examine these objects:

Advanced developers will occasionally use the following objects and enumerations.

Creating an Object

You can create an object by using the DIM statement. Afterwards, you will have to set one or more properties of the object, depending on its type and the context.

dim ti as SQL::TableInfo

dim ii as SQL::IndexInfo

dim ic as SQL::IndexColumnInfo

ti.Name = "MyTable"

ii.Name = "Primary_Key"

ii.PrimaryKey = .t.

ic.Name = "MyColumnName"

Frequently you will find a "child" object to be a property of a "parent" object. In these cases the "parent" object has already "DIMmed" it for you.

See Also

Working with SQL Databases, SQL::Connection Object, SQL::ResultSet Object, SQL::CallResult Object, SQL::Arguments Object

Supported By

Alpha Five Version 8 Enterprise Edition

Limitations

Desktop applications only.