Creates a new Database object, saves the database to disk, and returns an opened Database object (Microsoft Jet workspaces only).
Syntax
CdbDatabaseCreateDatabase(LPCTSTR pstrName,
LPCTSTR pstrConnect,
LONG lOption=-1);
Parameters
Type | Example | Description |
LPCTSTR | pstrName | A pointer to a string up to 255 characters long that is the name of the database file that you're creating. It can be the full path and file name, such as "C:\db1.mdb". If you don't supply a file name extension, .mdb is appended. If your network supports it, you can also specify a network path, such as "\\server1\share1\dir1\db1". You can only create .mdb database files with this method. |
LPCTSTR | pstrConnect | A pointer to a string that specifies various connection information, including passwords. |
LONG | lOption | Optional. A constant or combination of constants that indicates one or more options. See Settings in core topic for details. |
Usage
#include <afxole.h>
#include <dbdao.h>
CdbDBEngine dben;
CdbWorkspace wrkDefault;
CdbDatabase dbsNew;
wrkDefault = dben.Workspaces(0L);
/* Create a new encrypted database with the specified
(dbLangGeneral) collating order.
*/
dbsNew = wrkDefault.CreateDatabase(_T("NewDB.mdb"),
dbLangGeneral, dbEncrypt);
...
dbsNew.Close();