SQL Property Example (VC++)

This example creates a query based on an Orders table. The query selects all orders that have a Freight value greater than 10.

CdbDBEngine      dbeng;
CdbDatabase      dbsNorthwind;
CdbQueryDef      qdfLargeFrt;
CdbRecordset   rstFromQuery;

dbsNorthwind = dbeng.OpenDatabase(_T("Northwind.mdb"));
qdfLargeFrt = dbsNorthwind.CreateQueryDef(_T("Large Freight"));
qdfLargeFrt.SetSQL( _T("SELECT * FROM Orders WHERE Freight > 
10;"));
rstFromQuery = qdfLargeFrt.OpenRecordset(dbOpenSnapshot);
// process
rstFromQuery.Close();
dbsNorthwind.Close();