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( );
Return Value
The full path and filename for the database if successful; otherwise, an empty CString.
Remarks
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.
Requirements
Header: afxdao.h