Поделиться через


CDaoDatabase::GetName

Call this member function to retrieve the name of the currently open database, which is the name of an existing database file or registered ODBC data source name.

CString GetName( );

Возвращаемое значение

The full path and filename for the database if successful; otherwise, an empty CString.

Заметки

If your network supports the uniform naming convention (UNC), you can also specify a network path, such as "\\\\MYSERVER\\MYSHARE\\MYDIR\\MYDB.MDB". (Double backslashes are required in string literals because "\" is the C++ escape character.)

You might, for example, want to display this name in a heading. If an error occurs while retrieving the name, MFC throws an exception of type CDaoException.

ПримечаниеПримечание.

For better performance when accessing external databases, it is recommended that you attach external database tables to a Microsoft Jet engine database (.MDB) rather than connecting directly to the data source.

The database type is indicated by the file or directory that the path points to, as follows:

Pathname points to..

Database type

.MDB file

Microsoft Jet database (Microsoft Access)

Directory containing .DBF file(s)

dBASE® database

Directory containing .XLS file

Microsoft Excel database

Directory containing .PDX file(s)

Paradox® database

Directory containing appropriately formatted text database files

Text format database

For ODBC databases, such as Microsoft SQL Server and Oracle®, the database's connection string identifies a data source name (DSN) registered by ODBC.

Требования

Header: afxdao.h

См. также

Основные понятия

CDaoDatabase Class

CDaoDatabase Members

Hierarchy Chart

CDatabase::Open

CDatabase::GetConnect