共用方式為


CDaoWorkspace::Open

Explicitly opens a workspace object associated with DAO's default workspace.

virtual void Open( 
   LPCTSTR lpszName = NULL  
);

Parameters

  • lpszName
    The name of the DAO workspace object to open — a string with up to 14 characters that uniquely names the workspace. Accept the default value NULL to explicitly open the default workspace. For naming requirements, see the lpszName parameter for Create. For related information, see the topic "Name Property" in DAO Help.

Remarks

After constructing a CDaoWorkspace object, call this member function to do one of the following:

  • Explicitly open the default workspace. Pass NULL for lpszName.

  • Open an existing CDaoWorkspace object, a member of the Workspaces collection, by name. Pass a valid name for an existing workspace object.

Open puts the workspace object into an open state and also initializes the database engine if it has not already been initialized for your application.

Although many CDaoWorkspace member functions can only be called after the workspace has been opened, the following member functions, which operate on the database engine, are available after construction of the C++ object but before a call to Open:

Create

GetVersion

SetDefaultUser

GetIniPath

Idle

SetIniPath

GetLoginTimeout

SetDefaultPassword

SetLoginTimeout

Requirements

Header: afxdao.h

See Also

Concepts

CDaoWorkspace Class

CDaoWorkspace Members

Hierarchy Chart

CDaoWorkspace::IsOpen

CDaoWorkspace::CDaoWorkspace

CDaoWorkspace::Create

CDaoWorkspace::Close