E_FAIL initialize SQLCE using OLEDB, URGENT!! :(

E_FAIL initialize SQLCE using OLEDB, URGENT!! :(

Post by Ze » Fri, 13 Dec 2002 19:11:15



Hello,

A huge problem and cant find out what it is!! Please if someone knows
what the reason is to fail initialization, help!

I grab the code of NorthWindOleDb for SQL CE 2.0 and that one works
fine. But when I use the code to develop my own application, it
crashs! The function below is a my code.

This is very urgent, please help!!

Kind regard,

Zen
Soft.Engineer.

========================

HRESULT DBApplication::OpenDatabase()
{
   // Error code reporting
   HRESULT                hr = NOERROR;

   // Property used in property set to initialize provider
   DBPROP                 dbprop[1];                                      

   // Property Set used to initialize provider
   DBPROPSET      dbpropset[1];                            

   // Provider Interface Pointers
   IDBInitialize *pIDBInitialize = NULL;                
        IDBProperties *pIDBProperties   = NULL;        

        VariantInit(&dbprop[0].vValue);            
   // Create an instance of the OLE DB Provider
        hr = CoCreateInstance( CLSID_SQLSERVERCE_2_0,
                          0,
                          CLSCTX_INPROC_SERVER,
                          IID_IDBInitialize,
                (void **) &pIDBInitialize );
        if ( FAILED(hr) )
   {
           MessageBox(NULL,L"CoCreateInstance failed!", L"Casper", MB_OK);
      goto Exit;
   }
        // Initialize a property with name of database
        dbprop[0].dwPropertyID     = DBPROP_INIT_DATASOURCE;
        dbprop[0].dwOptions                = DBPROPOPTIONS_REQUIRED;
   dbprop[0].vValue.vt             = VT_BSTR;
   dbprop[0].vValue.bstrVal   = SysAllocString(DATABASE_MCASPER);

   if(dbprop[0].vValue.bstrVal == NULL)
        {
                hr = E_OUTOFMEMORY;
                goto Exit;
        }

        // Initialize the property set
        dbpropset[0].guidPropertySet = DBPROPSET_DBINIT;
        dbpropset[0].rgProperties         = dbprop;
        dbpropset[0].cProperties          = sizeof(dbprop) / sizeof(dbprop[0]);

        // Set initialization properties.
        hr = pIDBInitialize->QueryInterface(IID_IDBProperties, (void **)
&pIDBProperties);

   if(FAILED(hr))
   {  
      MessageBox(NULL,L"pIDBInitialize->QueryInterface failed!",
L"Casper", MB_OK);
      goto Exit;
   }
        // Sets properties in the Data Source and initialization property
groups
        // new -> hr = pIDBProperties->SetProperties( sizeof(dbprop) /
sizeof(dbprop[0]), dbpropset );
   hr = pIDBProperties->SetProperties(1, dbpropset);

   if(FAILED(hr))
   {
      MessageBox(NULL,L"pIDBProperties->SetProperties failed!",
L"Casper", MB_OK);
      goto Exit;
   }
        // Initializes a data source object
        hr = pIDBInitialize->Initialize();
        /*
        ** CRASHS!!!! Error = E_FAIL.
        **/
   if(FAILED(hr))
   {
      switch(hr)
      {

      case
              DB_S_ASYNCHRONOUS :
         MessageBox(NULL,L"async", L"Casper", MB_OK);
      break;
      case DB_S_ERRORSOCCURRED :
                       MessageBox(NULL,L"error", L"Casper", MB_OK);
      break;
      case E_FAIL :
         MessageBox(NULL,L"efail", L"Casper", MB_OK);
      break;
      case E_OUTOFMEMORY :
         MessageBox(NULL,L"out of mem", L"Casper", MB_OK);
      break;
      case E_UNEXPECTED :
         MessageBox(NULL,L"unex", L"Casper", MB_OK);
      break;
      case DB_E_ALREADYINITIALIZED :
         MessageBox(NULL,L"already", L"Casper", MB_OK);
      break;
      case DB_E_CANCELED :
         MessageBox(NULL,L"canc", L"Casper", MB_OK);
      break;
      case DB_E_ERRORSOCCURRED :
         MessageBox(NULL,L"errotrs occ", L"Casper", MB_OK);
      break;
      case DB_SEC_E_AUTH_FAILED :
         MessageBox(NULL,L"auth", L"Casper", MB_OK);
      break;

      }

      MessageBox(NULL,L"pIDBInitialize->Initialize() failed!",
L"Casper", MB_OK);
      goto Exit;
   }
   // Get IDBCreateSession interface
   hr = pIDBInitialize->QueryInterface(IID_IDBCreateSession, (void **)
&m_pIDBCreateSession);
   if (FAILED(hr))
      MessageBox(NULL,L"pIDBInitialize->QueryInterface!", L"Casper",
MB_OK);
Exit:
   // Clear Variant
   VariantClear(&dbprop[0].vValue);

        // Release interfaces
        if(pIDBProperties)
                pIDBProperties->Release();

   if(pIDBInitialize)
      pIDBInitialize->Release();

        return hr;

Quote:} // DBApplication::OpenDatabase

 
 
 

E_FAIL initialize SQLCE using OLEDB, URGENT!! :(

Post by Kevin Boske - [MS » Sat, 14 Dec 2002 04:22:00


Hi Zen,

Your code looks good, check the following:

Make sure that your database path used in DATABASE_MCASPER is a valid
database file.

Also, check and make sure you haven't set the file attribute to read-only.

--
Kevin Boske
SQL Server CE Team
Microsoft
----------------------------------------------------------------------------
----------------------------------------
Everything you need to know about SQL Server CE:

http://www.microsoft.com/sql/ce/techinfo/default.asp
----------------------------------------------------------------------------
----------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
----------------------------------------------------------------------------
----------------------------------------


Hello,

A huge problem and cant find out what it is!! Please if someone knows
what the reason is to fail initialization, help!

I grab the code of NorthWindOleDb for SQL CE 2.0 and that one works
fine. But when I use the code to develop my own application, it
crashs! The function below is a my code.

This is very urgent, please help!!

Kind regard,

Zen
Soft.Engineer.

========================

HRESULT DBApplication::OpenDatabase()
{
   // Error code reporting
   HRESULT   hr = NOERROR;

   // Property used in property set to initialize provider
   DBPROP   dbprop[1];

   // Property Set used to initialize provider
   DBPROPSET   dbpropset[1];

   // Provider Interface Pointers
   IDBInitialize *pIDBInitialize = NULL;
IDBProperties *pIDBProperties = NULL;

VariantInit(&dbprop[0].vValue);
   // Create an instance of the OLE DB Provider
hr = CoCreateInstance( CLSID_SQLSERVERCE_2_0,
                          0,
                          CLSCTX_INPROC_SERVER,
                          IID_IDBInitialize,
        (void **) &pIDBInitialize );
if ( FAILED(hr) )
   {
   MessageBox(NULL,L"CoCreateInstance failed!", L"Casper", MB_OK);
      goto Exit;
   }
// Initialize a property with name of database
dbprop[0].dwPropertyID    = DBPROP_INIT_DATASOURCE;
dbprop[0].dwOptions    = DBPROPOPTIONS_REQUIRED;
   dbprop[0].vValue.vt    = VT_BSTR;
   dbprop[0].vValue.bstrVal   = SysAllocString(DATABASE_MCASPER);

   if(dbprop[0].vValue.bstrVal == NULL)
{
hr = E_OUTOFMEMORY;
goto Exit;

Quote:}

// Initialize the property set
dbpropset[0].guidPropertySet = DBPROPSET_DBINIT;
dbpropset[0].rgProperties   = dbprop;
dbpropset[0].cProperties   = sizeof(dbprop) / sizeof(dbprop[0]);

// Set initialization properties.
hr = pIDBInitialize->QueryInterface(IID_IDBProperties, (void **)
&pIDBProperties);

   if(FAILED(hr))
   {
      MessageBox(NULL,L"pIDBInitialize->QueryInterface failed!",
L"Casper", MB_OK);
      goto Exit;
   }
// Sets properties in the Data Source and initialization property
groups
// new -> hr = pIDBProperties->SetProperties( sizeof(dbprop) /
sizeof(dbprop[0]), dbpropset );
   hr = pIDBProperties->SetProperties(1, dbpropset);

   if(FAILED(hr))
   {
      MessageBox(NULL,L"pIDBProperties->SetProperties failed!",
L"Casper", MB_OK);
      goto Exit;
   }
// Initializes a data source object
hr = pIDBInitialize->Initialize();
/*
        ** CRASHS!!!! Error = E_FAIL.
        **/
   if(FAILED(hr))
   {
      switch(hr)
      {

      case
      DB_S_ASYNCHRONOUS :
         MessageBox(NULL,L"async", L"Casper", MB_OK);
      break;
      case DB_S_ERRORSOCCURRED :
                       MessageBox(NULL,L"error", L"Casper", MB_OK);
      break;
      case E_FAIL :
         MessageBox(NULL,L"efail", L"Casper", MB_OK);
      break;
      case E_OUTOFMEMORY :
         MessageBox(NULL,L"out of mem", L"Casper", MB_OK);
      break;
      case E_UNEXPECTED :
         MessageBox(NULL,L"unex", L"Casper", MB_OK);
      break;
      case DB_E_ALREADYINITIALIZED :
         MessageBox(NULL,L"already", L"Casper", MB_OK);
      break;
      case DB_E_CANCELED :
         MessageBox(NULL,L"canc", L"Casper", MB_OK);
      break;
      case DB_E_ERRORSOCCURRED :
         MessageBox(NULL,L"errotrs occ", L"Casper", MB_OK);
      break;
      case DB_SEC_E_AUTH_FAILED :
         MessageBox(NULL,L"auth", L"Casper", MB_OK);
      break;

      }

      MessageBox(NULL,L"pIDBInitialize->Initialize() failed!",
L"Casper", MB_OK);
      goto Exit;
   }
   // Get IDBCreateSession interface
   hr = pIDBInitialize->QueryInterface(IID_IDBCreateSession, (void **)
&m_pIDBCreateSession);
   if (FAILED(hr))
      MessageBox(NULL,L"pIDBInitialize->QueryInterface!", L"Casper",
MB_OK);
Exit:
   // Clear Variant
   VariantClear(&dbprop[0].vValue);

// Release interfaces
if(pIDBProperties)
pIDBProperties->Release();

   if(pIDBInitialize)
      pIDBInitialize->Release();

return hr;

Quote:} // DBApplication::OpenDatabase


 
 
 

E_FAIL initialize SQLCE using OLEDB, URGENT!! :(

Post by Amy Yuan - [MS » Sun, 15 Dec 2002 10:16:04


Hi Zen,

When you get error like E_FAIL or DB_E_ERRORSOCCURRED, you can use
IErrorRecords to get minor error code. Then either get error description
from IErrorRecords or look up the minor error code in BOL to get more
details on the error.

Sample code on IErrorRecords below. To use it, right after init fails, call
PrintErrorInfo (IID_IDBInitialize, pIDBInitialize). It prints out minor
error and error description to console.

-----------
Amy Yuan

HRESULT PrintErrorInfo(REFIID riid, IUnknown *pComponent)
{
 IErrorInfo        * pErrorInfo   = NULL;
 IErrorInfo        * pErrorInfoRec  = NULL;
 IErrorRecords     * pErrorRecords  = NULL;
 ISupportErrorInfo * pSupportErrorInfo = NULL;
 HRESULT             hr     = E_FAIL;
 ULONG               i, ulNumErrorRecs;
 ERRORINFO           ErrorInfo;

 memset (&ErrorInfo, '\0', sizeof(ERRORINFO));

 hr = pComponent->QueryInterface(IID_ISupportErrorInfo, (LPVOID FAR*)
&pSupportErrorInfo);
 if (SUCCEEDED(hr))
 {
  hr = pSupportErrorInfo->InterfaceSupportsErrorInfo(riid);
  if(hr == S_OK)
  {
   hr = GetErrorInfo(0, &pErrorInfo);
   if (!pErrorInfo)
   {
    hr = pSupportErrorInfo->Release();
    return (hr);
   }

   hr = pErrorInfo->QueryInterface(IID_IErrorRecords, (LPVOID FAR*)
&pErrorRecords);
   hr = pErrorRecords->GetRecordCount(&ulNumErrorRecs);

   //If no error records but we are expecting one, then fail here
   if (0 == ulNumErrorRecs)
   {
    hr = pSupportErrorInfo->Release();
    hr = pErrorRecords->Release();
    return (hr);
   }

   for (i = 0; i < ulNumErrorRecs; i++)
   {
    hr = pErrorRecords->GetBasicErrorInfo(i, &ErrorInfo);

    hr = pErrorRecords->GetErrorInfo(i, NULL, &pErrorInfoRec);
    BSTR bstrDescriptionOfError = NULL;
    BSTR bstrSourceOfError = NULL;

    hr = pErrorInfoRec->GetDescription(&bstrDescriptionOfError);
    hr = pErrorInfoRec->GetSource(&bstrSourceOfError);

    {
     wcerr << endl << L"Source: ";
     if(bstrSourceOfError)
      wcerr << bstrSourceOfError << endl;
     else
      wcerr << L"***** NO SOURCE OF ERROR *****" << endl;

     wcerr << L"Description: ";
     if(bstrDescriptionOfError)
      wcerr << bstrDescriptionOfError << endl;
     else
      wcerr << L"***** NO DESCRIPTION OF ERROR *****" << endl;

     wcerr << L"Minor: " << ErrorInfo.dwMinor << endl;

     wcerr << L"HRESULT: 0x" << hex << ErrorInfo.hrError << endl << endl;
    }

    SysFreeString(bstrDescriptionOfError);
    SysFreeString(bstrSourceOfError);
    ReleaseAndNullInterface(pErrorInfoRec);

    getch();
   }

   ReleaseAndNullInterface(pErrorInfo);
   ReleaseAndNullInterface(pErrorRecords);
  }
  ReleaseAndNullInterface(pSupportErrorInfo);
 }

 return hr;

}
"Zen" <zenon...@hotmail.com> wrote in message

news:7cd7203b.0212120211.39d129cb@posting.google.com...
> Hello,

> A huge problem and cant find out what it is!! Please if someone knows
> what the reason is to fail initialization, help!

> I grab the code of NorthWindOleDb for SQL CE 2.0 and that one works
> fine. But when I use the code to develop my own application, it
> crashs! The function below is a my code.

> This is very urgent, please help!!

> Kind regard,

> Zen
> Soft.Engineer.

> ========================

> HRESULT DBApplication::OpenDatabase()
> {
>    // Error code reporting
>    HRESULT   hr = NOERROR;

>    // Property used in property set to initialize provider
>    DBPROP   dbprop[1];

>    // Property Set used to initialize provider
>    DBPROPSET   dbpropset[1];

>    // Provider Interface Pointers
>    IDBInitialize *pIDBInitialize = NULL;
> IDBProperties *pIDBProperties = NULL;

> VariantInit(&dbprop[0].vValue);
>    // Create an instance of the OLE DB Provider
> hr = CoCreateInstance( CLSID_SQLSERVERCE_2_0,
>                           0,
>                           CLSCTX_INPROC_SERVER,
>                           IID_IDBInitialize,
>         (void **) &pIDBInitialize );
> if ( FAILED(hr) )
>    {
>    MessageBox(NULL,L"CoCreateInstance failed!", L"Casper", MB_OK);
>       goto Exit;
>    }
> // Initialize a property with name of database
> dbprop[0].dwPropertyID    = DBPROP_INIT_DATASOURCE;
> dbprop[0].dwOptions    = DBPROPOPTIONS_REQUIRED;
>    dbprop[0].vValue.vt    = VT_BSTR;
>    dbprop[0].vValue.bstrVal   = SysAllocString(DATABASE_MCASPER);

>    if(dbprop[0].vValue.bstrVal == NULL)
> {
> hr = E_OUTOFMEMORY;
> goto Exit;
> }

> // Initialize the property set
> dbpropset[0].guidPropertySet = DBPROPSET_DBINIT;
> dbpropset[0].rgProperties   = dbprop;
> dbpropset[0].cProperties   = sizeof(dbprop) / sizeof(dbprop[0]);

> // Set initialization properties.
> hr = pIDBInitialize->QueryInterface(IID_IDBProperties, (void **)
> &pIDBProperties);

>    if(FAILED(hr))
>    {
>       MessageBox(NULL,L"pIDBInitialize->QueryInterface failed!",
> L"Casper", MB_OK);
>       goto Exit;
>    }
> // Sets properties in the Data Source and initialization property
> groups
> // new -> hr = pIDBProperties->SetProperties( sizeof(dbprop) /
> sizeof(dbprop[0]), dbpropset );
>    hr = pIDBProperties->SetProperties(1, dbpropset);

>    if(FAILED(hr))
>    {
>       MessageBox(NULL,L"pIDBProperties->SetProperties failed!",
> L"Casper", MB_OK);
>       goto Exit;
>    }
> // Initializes a data source object
> hr = pIDBInitialize->Initialize();
> /*
>         ** CRASHS!!!! Error = E_FAIL.
>         **/
>    if(FAILED(hr))
>    {
>       switch(hr)
>       {

>       case
>       DB_S_ASYNCHRONOUS :
>          MessageBox(NULL,L"async", L"Casper", MB_OK);
>       break;
>       case DB_S_ERRORSOCCURRED :
>                        MessageBox(NULL,L"error", L"Casper", MB_OK);
>       break;
>       case E_FAIL :
>          MessageBox(NULL,L"efail", L"Casper", MB_OK);
>       break;
>       case E_OUTOFMEMORY :
>          MessageBox(NULL,L"out of mem", L"Casper", MB_OK);
>       break;
>       case E_UNEXPECTED :
>          MessageBox(NULL,L"unex", L"Casper", MB_OK);
>       break;
>       case DB_E_ALREADYINITIALIZED :
>          MessageBox(NULL,L"already", L"Casper", MB_OK);
>       break;
>       case DB_E_CANCELED :
>          MessageBox(NULL,L"canc", L"Casper", MB_OK);
>       break;
>       case DB_E_ERRORSOCCURRED :
>          MessageBox(NULL,L"errotrs occ", L"Casper", MB_OK);
>       break;
>       case DB_SEC_E_AUTH_FAILED :
>          MessageBox(NULL,L"auth", L"Casper", MB_OK);
>       break;

>       }

>       MessageBox(NULL,L"pIDBInitialize->Initialize() failed!",
> L"Casper", MB_OK);
>       goto Exit;
>    }
>    // Get IDBCreateSession interface
>    hr = pIDBInitialize->QueryInterface(IID_IDBCreateSession, (void **)
> &m_pIDBCreateSession);
>    if (FAILED(hr))
>       MessageBox(NULL,L"pIDBInitialize->QueryInterface!", L"Casper",
> MB_OK);
> Exit:
>    // Clear Variant
>    VariantClear(&dbprop[0].vValue);

> // Release interfaces
> if(pIDBProperties)
> pIDBProperties->Release();

>    if(pIDBInitialize)
>       pIDBInitialize->Release();

> return hr;
> } // DBApplication::OpenDatabase

 
 
 

E_FAIL initialize SQLCE using OLEDB, URGENT!! :(

Post by Zen » Tue, 31 Dec 2002 18:29:07


Thanks for your answers.

It helped a lot, but got still some strange problems.....

Quote:>-----Original Message-----
>Hi Zen,

>Your code looks good, check the following:

>Make sure that your database path used in

DATABASE_MCASPER is a valid
Quote:>database file.

>Also, check and make sure you haven't set the file

attribute to read-only.

>--
>Kevin Boske
>SQL Server CE Team
>Microsoft
>----------------------------------------------------------
------------------
>----------------------------------------
>Everything you need to know about SQL Server CE:

>http://www.microsoft.com/sql/ce/techinfo/default.asp
>----------------------------------------------------------
------------------
>----------------------------------------
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>----------------------------------------------------------
------------------
>----------------------------------------



>Hello,

>A huge problem and cant find out what it is!! Please if
someone knows
>what the reason is to fail initialization, help!

>I grab the code of NorthWindOleDb for SQL CE 2.0 and that
one works
>fine. But when I use the code to develop my own
application, it
>crashs! The function below is a my code.

>This is very urgent, please help!!

>Kind regard,

>Zen
>Soft.Engineer.

>========================

>HRESULT DBApplication::OpenDatabase()
>{
>   // Error code reporting
>   HRESULT   hr = NOERROR;

>   // Property used in property set to initialize provider
>   DBPROP   dbprop[1];

>   // Property Set used to initialize provider
>   DBPROPSET   dbpropset[1];

>   // Provider Interface Pointers
>   IDBInitialize *pIDBInitialize = NULL;
>IDBProperties *pIDBProperties = NULL;

>VariantInit(&dbprop[0].vValue);
>   // Create an instance of the OLE DB Provider
>hr = CoCreateInstance( CLSID_SQLSERVERCE_2_0,
>                          0,
>                          CLSCTX_INPROC_SERVER,
>                          IID_IDBInitialize,
>        (void **) &pIDBInitialize );
>if ( FAILED(hr) )
>   {
>   MessageBox(NULL,L"CoCreateInstance failed!",
L"Casper", MB_OK);
>      goto Exit;
>   }
>// Initialize a property with name of database
>dbprop[0].dwPropertyID    = DBPROP_INIT_DATASOURCE;
>dbprop[0].dwOptions    = DBPROPOPTIONS_REQUIRED;
>   dbprop[0].vValue.vt    = VT_BSTR;
>   dbprop[0].vValue.bstrVal   = SysAllocString
(DATABASE_MCASPER);

>   if(dbprop[0].vValue.bstrVal == NULL)
>{
>hr = E_OUTOFMEMORY;
>goto Exit;
>}

>// Initialize the property set
>dbpropset[0].guidPropertySet = DBPROPSET_DBINIT;
>dbpropset[0].rgProperties   = dbprop;
>dbpropset[0].cProperties   = sizeof(dbprop) / sizeof
(dbprop[0]);

>// Set initialization properties.
>hr = pIDBInitialize->QueryInterface(IID_IDBProperties,
(void **)
>&pIDBProperties);

>   if(FAILED(hr))
>   {
>      MessageBox(NULL,L"pIDBInitialize->QueryInterface
failed!",
>L"Casper", MB_OK);
>      goto Exit;
>   }
>// Sets properties in the Data Source and initialization
property
>groups
>// new -> hr = pIDBProperties->SetProperties( sizeof
(dbprop) /
>sizeof(dbprop[0]), dbpropset );
>   hr = pIDBProperties->SetProperties(1, dbpropset);

>   if(FAILED(hr))
>   {
>      MessageBox(NULL,L"pIDBProperties->SetProperties
failed!",
>L"Casper", MB_OK);
>      goto Exit;
>   }
>// Initializes a data source object
>hr = pIDBInitialize->Initialize();
>/*
>        ** CRASHS!!!! Error = E_FAIL.
>        **/
>   if(FAILED(hr))
>   {
>      switch(hr)
>      {

>      case
>      DB_S_ASYNCHRONOUS :
>         MessageBox(NULL,L"async", L"Casper", MB_OK);
>      break;
>      case DB_S_ERRORSOCCURRED :
>                       MessageBox(NULL,L"error",
L"Casper", MB_OK);
>      break;
>      case E_FAIL :
>         MessageBox(NULL,L"efail", L"Casper", MB_OK);
>      break;
>      case E_OUTOFMEMORY :
>         MessageBox(NULL,L"out of mem", L"Casper", MB_OK);
>      break;
>      case E_UNEXPECTED :
>         MessageBox(NULL,L"unex", L"Casper", MB_OK);
>      break;
>      case DB_E_ALREADYINITIALIZED :
>         MessageBox(NULL,L"already", L"Casper", MB_OK);
>      break;
>      case DB_E_CANCELED :
>         MessageBox(NULL,L"canc", L"Casper", MB_OK);
>      break;
>      case DB_E_ERRORSOCCURRED :
>         MessageBox(NULL,L"errotrs occ", L"Casper",
MB_OK);
>      break;
>      case DB_SEC_E_AUTH_FAILED :
>         MessageBox(NULL,L"auth", L"Casper", MB_OK);
>      break;

>      }

>      MessageBox(NULL,L"pIDBInitialize->Initialize()
failed!",
>L"Casper", MB_OK);
>      goto Exit;
>   }
>   // Get IDBCreateSession interface
>   hr = pIDBInitialize->QueryInterface

(IID_IDBCreateSession, (void **)

- Show quoted text -

Quote:>&m_pIDBCreateSession);
>   if (FAILED(hr))
>      MessageBox(NULL,L"pIDBInitialize->QueryInterface!",
L"Casper",
>MB_OK);
>Exit:
>   // Clear Variant
>   VariantClear(&dbprop[0].vValue);

>// Release interfaces
>if(pIDBProperties)
>pIDBProperties->Release();

>   if(pIDBInitialize)
>      pIDBInitialize->Release();

>return hr;
>} // DBApplication::OpenDatabase

>.