Jet 4.0 crashes when accessing an Access 97 .mdb 
Author Message
 Jet 4.0 crashes when accessing an Access 97 .mdb

When I try to use the code listed below to use the Jet 4.0 engine with
an .mdb file created with Access 97 it crashes with a stack overflow in
the jet DLL when the rowset is opened.  Does anyone know if this can be
done? If so, how?

// TestJob.H : Declaration of the CTestJob class

#ifndef __TESTJOB_H_
#define __TESTJOB_H_

class CTestJobAccessor
{
public:
   LONG m_DatasetID; // Dataset ID of host JCL library
   LONG m_JobID;  // Unique number within Job table
   TCHAR m_JobName[11]; // Entity name
   LONG m_JobNumber; // Relative number within host dataset
   TCHAR m_MemberName[16]; // Member name of host Job
   VARIANT_BOOL m_Missing; // Not found during scan
   SHORT m_Properties;  // Job properties defined in ????.h

BEGIN_COLUMN_MAP(CTestJobAccessor)
   COLUMN_ENTRY(1, m_JobID)
   COLUMN_ENTRY(2, m_JobName)
   COLUMN_ENTRY(3, m_DatasetID)
   COLUMN_ENTRY(4, m_MemberName)
   COLUMN_ENTRY(5, m_JobNumber)
   COLUMN_ENTRY_TYPE(6, DBTYPE_BOOL, m_Missing)
   COLUMN_ENTRY(7, m_Properties)
END_COLUMN_MAP()

   // You may wish to call this function if you are inserting a record
and wish to
   // initialize all the fields, if you are not going to explicitly set
all of them.
   void ClearRecord()
   {
      memset(this, 0, sizeof(*this));
   }

Quote:
};

class CTestJob : public CTable<CAccessor<CTestJobAccessor> >
{
public:
   HRESULT Open()
   {
      HRESULT     hr;

      hr = OpenDataSource();
      if (FAILED(hr))
         return hr;

      return OpenRowset();
   }
   HRESULT OpenDataSource()
   {
      HRESULT     hr;
      CDataSource db;
      CDBPropSet  dbinit(DBPROPSET_DBINIT);

      dbinit.AddProperty(DBPROP_AUTH_CACHE_AUTHINFO, true);
      dbinit.AddProperty(DBPROP_AUTH_ENCRYPT_PASSWORD, false);
      dbinit.AddProperty(DBPROP_AUTH_MASK_PASSWORD, false);
      dbinit.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR(""));
      dbinit.AddProperty(DBPROP_AUTH_USERID, OLESTR("Admin"));
      dbinit.AddProperty(DBPROP_INIT_DATASOURCE,
OLESTR("F:\\xpp\\aa\\aa.mdb"));
      dbinit.AddProperty(DBPROP_INIT_MODE, (long)16);
      dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
      dbinit.AddProperty(DBPROP_INIT_PROVIDERSTRING, OLESTR(""));
      dbinit.AddProperty(DBPROP_INIT_LCID, (long)1033);
      hr = db.Open(_T("Microsoft.Jet.OLEDB.4.0"), &dbinit);
      if (FAILED(hr))
         return hr;

      return m_session.Open(db);
   }
   HRESULT OpenRowset()
   {
      // Set properties for open
      CDBPropSet  propset(DBPROPSET_ROWSET);
      propset.AddProperty(DBPROP_IRowsetChange, true);
      propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE |
DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE);
      return CTable<CAccessor<CTestJobAccessor> >::Open(m_session,
_T("Job"), &propset);
   }
   CSession m_session;

Quote:
};

#endif // __TESTJOB_H_

void ReadJobs()
{
   CTestJob dbJobs;
   if (SUCCEEDED(dbJobs.Open()))
   {
      while (dbJobs.MoveNext() == S_OK)
      {
         // Do something...
      }
   }

Quote:
}



Mon, 04 Mar 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Converting Access 97 MDB file to Access 2000

2. Reading access 2000 mdb in Vc 97

3. VC++ 4.0 with Access '97

4. OLE DB MS Jet 4.0 and Excel 97

5. Access 95 -> Access 97

6. Access 2000/Access 97

7. Q: How to access an Access 97 database in Visual C++ 5.0

8. How to access Custom Database Properties of a Access 97 database programmatically

9. Is there a C/C++ library to access MS Access 97

10. temporary tables in Access Jet 4.0

11. Strange ODBC errors using DAO to access linked tables in Access .MDB

12. Can I access an access (mdb) file within DOS

 

 
Powered by phpBB® Forum Software