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
   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

   COLUMN_ENTRY(2, m_JobName)
   COLUMN_ENTRY(3, m_DatasetID)
   COLUMN_ENTRY(4, m_MemberName)
   COLUMN_ENTRY(5, m_JobNumber)
   COLUMN_ENTRY(7, m_Properties)

   // 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));


class CTestJob : public CTable<CAccessor<CTestJobAccessor> >
   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_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);
      return CTable<CAccessor<CTestJobAccessor> >::Open(m_session,
_T("Job"), &propset);
   CSession m_session;


#endif // __TESTJOB_H_

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


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