다음을 통해 공유


CDatabase::GetDatabaseName

Call this member function to retrieve the name of the currently connected database (provided that the data source defines a named object called "database").

CString GetDatabaseName( ) const;

Return Value

A CString containing the database name if successful; otherwise, an empty CString.

Remarks

This is not the same as the data source name (DSN) specified in the OpenEx or Open call. What GetDatabaseName returns depends on ODBC. In general, a database is a collection of tables. If this entity has a name, GetDatabaseName returns it.

You might, for example, want to display this name in a heading. If an error occurs while retrieving the name from ODBC, GetDatabaseName returns an empty Cstring.

Requirements

Header: afxdb.h

See Also

Reference

CDatabase Class

Hierarchy Chart

CDatabase::OpenEx

CDatabase::Open

CDatabase::GetConnect

Other Resources

CDatabase Members