Delen via


CDaoQueryDef::SetConnect

Call this member function to set the querydef object's connection string.

void SetConnect( 
   LPCTSTR lpszConnect  
);

Parameters

  • lpszConnect
    A string that contains a connection string for the associated CDaoDatabase object.

Remarks

The connection string is used to pass additional information to ODBC and certain ISAM drivers as needed. It is not used for Microsoft Jet (.MDB) databases.

Tip

The preferred way to work with ODBC tables is to attach them to an .MDB database.

Before executing a querydef that represents a SQL pass-through query to an ODBC data source, set the connection string with SetConnect and call SetReturnsRecords to specify whether the query returns records.

For more information about the connection string's structure and examples of connection string components, see the topic "Connect Property" in DAO Help.

Requirements

Header: afxdao.h

See Also

Reference

CDaoQueryDef Class

Hierarchy Chart