Microsoft KB Archive/146876

= DAO error 3028 may occur when you try to create a workspace DAO object in Visual C++ =

Article ID: 146876

Article Last Modified on 6/2/2005

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li> The DAO SDK, when used with:  Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 4.1 Subscription</li></ul>

 Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 <li>Microsoft Visual C++ 5.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q146876

<div class="symptoms_section">

SYMPTOMS
The following DAO error 3028 may occur when you try to create a workspace DAO object:

Can't start application. The system database is missing or opened

exclusively by another user.

<div class="cause_section">

CAUSE
This error can occur if you have failed to specify a system database or have assigned the system database after performing operations with the database engine.

<div class="resolution_section">

RESOLUTION
It is important that the SystemDB property of the database engine be set prior to performing any operations with the database engine. If you are using the dbDAO C++ classes included with the DAO SDK, you can set the system database by using code similar to this code: // get database engine object but don't fill its collections CdbDBEngine eng(FALSE, FALSE);

// set the system database eng.SetSystemDB(_T("d:\\work\\sectest.mdw"));

// Finish initializing the engine object eng.Start;

CdbWorkspace wsp;

// The following function call will generate the 3028 // error if a System Database hasn't been assigned or if the // second argument of the constructor for CdbDBEngine didn't  // receive FALSE.

wsp= eng.CreateWorkspace(_T("Test"),_T("MyUserName"),                           _T("MyPassword")); Or, alternately, use the CdbDBEngine::SetInitPath method before opening or creating a CdbWorkspace object.

If you are using the MFC DAO classes, use code similar to this code: //Initialize global MFC DAO engine AfxDaoInit; DAODBEngine* pDBEngine = AfxDaoGetEngine;

// Set up system database COleVariant var( _T("d:\\work\\sectest.mdw"), VT_BSTRT ); // NOTE: put_SystemDB was a late addition to DAO // and is not yet wrapped by MFC DAO_CHECK( pDBEngine->put_SystemDB( var.bstrVal ) );

CDaoWorkspace wsp; wsp.Create(_T("Test"),_T("MyUserName"), _T("MyPassword")); Or, alternately, use the CDaoWorkspace::SetInitPath method before opening or creating a CDaoWorkspace object.

<div class="status_section">

STATUS
This behavior is by design.

Keywords: kberrmsg kbtshoot kbdatabase kbprb kbcode KB146876

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.