ADO Tips & Tricks

1)     Connection Object

a)      Opening the Database

b)      Executing Commands

c)       Executing Queries

d)      Closing the Database

2)     Recordset Object

a)      The Fields Collection

b)      Editing Records

3)     Tools

a)      One Column Queries

b)      ComboBox Example

c)       One Row Queries

d)      Multi-Column Queries

e)      Getting Field Names

f)        ComboBox Example, 2

4)     A Useful Example

a)      The SELECT Clause

b)      The WHERE Clause

c)       The Query

 

Download Example Programs

 

 

 

 

The Query

' Make a list of records that match the query.

Private Sub cmdList_Click()

Dim select_clause As String

Dim where_clause As String

Dim query As String

 

    ' Build the SELECT clause.

    select_clause = SelectClause()

 

    ' Build the WHERE clause.

    where_clause = WhereClause()

 

    ' Compose the query.

    query = select_clause & _

        " FROM Customers " & _

        where_clause

 

    ' Execute the query and display the results in the MSFlexGrid.

    InitializeFlexGridFromQuery Me, flxResults, query

 

    ' Sort by the selected sort column.

    m_SortColumn = -1

    SortByColumn 0

End Sub