DAO Cache? 
Author Message
 DAO Cache?

I believe i am missing some "flush" mechanism or i do not understand the OLE
or COM connection with DAORecordSet objects. When i step through a newly
created recordset (via AddNew), the new record does not appear (in Access as
debug terminal) until a few single steps after the call to Update. Sometimes
i must return from a function (destructors called?).  Why don't i see this
immediately as the documentation suggests?

A similar question relates to a parameterized query...I create an object in
a set and then perform a query. The query comes up empty, although i can
perform the same simple query in Access before i fail in VC++ and the set
exists. If i run my code a second time, the query works. I tried manually
dirtying the fields with SetFieldDirty, but it choked big time!

Am i missing a rule regarding Open, Close... Can i keep a recordset open (in
the above example, i call matching Close)? One thing i did not do in the
case of the paramerized query is destroy the derived DAORecordSet object
that created the record before i created the parameterized DAORecordSet
object. I have a few DAORecordSet objects as static members of classes.
Although i Open and Close on a regular basis, i never destroy the set.

Mucho thanks in advance,

Lance



Mon, 18 Sep 2000 03:00:00 GMT  
 DAO Cache?

Hey!

An added piece of info on my problems with parameterized queries (which now
puzzles me even more): I can get it to work every time if i simlpy use the
m_strFilter and manually stuff in the criteria string. If i use a parameter,
it does not show up! What is the difference? I know my parameter is correct.
If i run my program a second time, the parameter works!

Thanks in advance,

Lance


Quote:
>I believe i am missing some "flush" mechanism or i do not understand the
OLE
>or COM connection with DAORecordSet objects. When i step through a newly
>created recordset (via AddNew), the new record does not appear (in Access
as
>debug terminal) until a few single steps after the call to Update.
Sometimes
>i must return from a function (destructors called?).  Why don't i see this
>immediately as the documentation suggests?

>A similar question relates to a parameterized query...I create an object in
>a set and then perform a query. The query comes up empty, although i can
>perform the same simple query in Access before i fail in VC++ and the set
>exists. If i run my code a second time, the query works. I tried manually
>dirtying the fields with SetFieldDirty, but it choked big time!

>Am i missing a rule regarding Open, Close... Can i keep a recordset open
(in
>the above example, i call matching Close)? One thing i did not do in the
>case of the paramerized query is destroy the derived DAORecordSet object
>that created the record before i created the parameterized DAORecordSet
>object. I have a few DAORecordSet objects as static members of classes.
>Although i Open and Close on a regular basis, i never destroy the set.

>Mucho thanks in advance,

>Lance



Wed, 20 Sep 2000 03:00:00 GMT  
 DAO Cache?

Hi!
I found following out in Requery:
If the m_strFilter has changed the Recordset will be closed and opened.
If only the parameter has changed the Recordset will be requeried.

Look to the code from DAOCORE.CPP:

void CDaoRecordset::Requery()
{
ASSERT_VALID(this);
ASSERT(IsOpen());
ASSERT(CanRestart());
// If filter or sort strings changed, must Close and Open
// This is only effective if m_strFilter/m_strSort used
if ((m_pQueryDef != NULL &&
  (m_nStatus & AFX_DAO_IMPLICIT_QD)) &&
  ((m_strRequeryFilter != m_strFilter) ||
  (m_strRequerySort != m_strSort)))
{
  Close();
  Open(m_nOpenType, m_strRequerySQL, m_nOptions);

Quote:
}

else
{
  // Rebind parameters in case values have changed
  BindParameters();
  if (m_pQueryDef != NULL)
  {
   COleVariant varDisp;
   varDisp.pdispVal = m_pQueryDef->m_pDAOQueryDef;
   varDisp.vt = VT_DISPATCH;
   TRY
   {
    DAO_CHECK(m_pDAORecordset->Requery(varDisp));
   }
   CATCH_ALL(e)
   {
    // Reset vt to prevent release of DAOQueryDef
    varDisp.vt = VT_EMPTY;
    THROW_LAST();
   }
   END_CATCH_ALL
   // Reset vt to prevent release of DAOQueryDef
   varDisp.vt = VT_EMPTY;
  }
  else
   // Must be a table type recordset (this will fail!)
   DAO_CHECK(m_pDAORecordset->Requery(_afxOptionalVariant));
  GetDataAndFixupNulls();

Quote:
}
}

        Michael

----------------------------------------------------------------------------
----

German URL:   http://members.carinthia.com/gnovak/paddeln
English  URL:   http://members.carinthia.com/gnovak/paddle
----------------------------------------------------------------------------
----



Tue, 26 Sep 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. System.Web.Caching.Cache

2. Migration of DAO 3.0 vs. DAO 3.5

3. Migration of DAO 3.0 vs. DAO 3.5

4. Calling DAO directly from MFC DAO classes

5. MFC DAO or DAO SDK.

6. How to go from DAO 3.5 to DAO 3.6

7. mfc dao vs. dao sdk

8. Can not read contents of field with the DAO SDK (Not MFC DAO)

9. Migration of DAO 3.0 vs. DAO 3.5

10. DAO 3.60 crashes app that works fine with DAO 3.50

11. How can I Programatically Clear cached Files or Not cache Files using C++?

12. Global Assembly Cache (GAC) question

 

 
Powered by phpBB® Forum Software