CDaoDatabase::GetConnect

CString GetConnect( );
throw( CDaoException, CMemoryException );

Return Value

The connect 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

Call this member function to retrieve the connect string used to connect the CDaoDatabase object to an ODBC or ISAM database. The string provides information about the source of an open database or a database used in a pass-through query. The connect string is composed of a database type specifier and zero or more parameters separated by semicolons. For additional information about connect strings in DAO, see the topic "Connect Property" in DAO Help.

Important   Using the MFC DAO classes to connect to a data source via ODBC is less efficient than connecting via an attached table. For more information, see the article DAO External: Working with External Data Sources in Visual C++ Programmer's Guide.

Note   The connect 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 connect string is an empty string ("") except when you use it for an SQL pass-through query as described under Return Value above.

See the Open member function for a description of how the connect string is created. Once the connect 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.

For connect string syntax, see the topic "Connect Property" in DAO Help.

CDaoDatabase OverviewClass MembersHierarchy Chart