CdbDatabase::CreateQueryDef Method

Creates a new QueryDef object in a specified Database object.

Syntax

CdbQueryDefCreateQueryDef(LPCTSTR pstrName=NULL,

LPCTSTR pstrSQL=NULL);

Parameters

Type Example Description
LPCTSTR pstrName Optional. A pointer to a string that uniquely names the new QueryDef.
LPCTSTR pstrSQL Optional. A pointer to a string that is an SQL statement defining the QueryDef. If you omit this argument, you can define the QueryDef by setting its SQL property before or after you append it to a collection.

Usage

#include <afxole.h>
#include <dbdao.h>

CdbDatabase   db;
CdbQueryDef   qd1;
...                        // Initialize db, etc.
qd1 = CreateQueryDef(_T("QD_PARTS"), _T("SELECT * FROM PARTS"));