Partager via


CDaoDatabase::GetConnect

Call this member function to retrieve the connection string used to connect the CDaoDatabase object to an ODBC or ISAM database.

CString GetConnect( );

Return Value

The connection string if Open has been called successfully on an ODBC data source; otherwise, an empty string. For a Microsoft Jet (.MDB) database, the string is always empty unless you set it for use with the dbSQLPassThrough option used with the Execute member function or used in opening a recordset.

Remarks

The string provides information about the source of an open database or a database used in a pass-through query. The connection string is composed of a database type specifier and zero or more parameters separated by semicolons.

Notes

Using the MFC DAO classes to connect to a data source via ODBC is less efficient than connecting via an attached table.

Notes

The connection string is used to pass additional information to ODBC and certain ISAM drivers as needed. It is not used for .MDB databases. For Microsoft Jet database base tables, the connection string is an empty string ("") except when you use it for a SQL pass-through query as described under Return Value above.

See the Open member function for a description of how the connection string is created. Once the connection string has been set in the Open call, you can later use it to check the setting to determine the type, path, user ID, Password, or ODBC data source of the database.

Requirements

Header: afxdao.h

See Also

Concepts

CDaoDatabase Class

CDaoDatabase Members

Hierarchy Chart