Memory leak using AddNew()

  • Thread starter Thread starter Louis
  • Start date Start date
L

Louis

Hello,

I'm using the AddNew() function from CDaoRecordset with
Access 2000 and I have a memory leak problem. Here is my
source code:
---------------------------------------------

// The database m_Mydb is already open (CDaoDatabase)

CDaoRecordset oRecordSet(&m_Mydb);
CDaoQueryDef oQueryDef(&m_Mydb);

// Select all records from table [Data]
strQuery.Format("SELECT * FROM %s", "Data");

// Open recordset
oQueryDef.Create(NULL, strQuery);
oRecordSet.Open(&oQueryDef);

try
{
// Add a record
oRecordSet.AddNew();
oRecordSet.Update();
}
catch (CDaoException* pEx)
{
}
catch (CMemoryException* pEx)
{
}

// Close recordset
oRecordSet.Close();
oQueryDef.Close();
------------------------------------------------

When I loop several times on this code I found out
that the AddNew() function leaks some memory. If
someone has already encountered this problem please
let me know!

Thanks,

Louis
 
What do you mean, it leaks some memory? What is the error or other affect
you are getting?

TC
 
Back
Top