inlandchris
New member
- Local time
- Today, 14:09
- Joined
- Jan 22, 2014
- Messages
- 6
Hi all,
I have a program in C++ that uses MS Access database. When I need to lookup a database entry, I requery the database. When I requery the database a lot, the database gets corrupted, why. Here are some details below:
m_pApbLogSet->m_MyParam = 1;
m_pApbLogSet->m_nParams = 1;
m_pApbLogSet->m_strFilter = _T("Card = ?");
m_pApbLogSet->m_CardParam = CardNumber;
try
{
m_pApbLogSet->Requery();
}
catch(CDBException * e)
{
e->Delete();
}
if(m_pApbLogSet->IsBOF() && m_pApbLogSet->IsEOF())
{
return; //not found
// or sometimes I add a new record because the above was not found...other code in the program (m_pAPbLogSet->AddNew(); )
}
I set the filter to a card number (in this case) and run the Requery(). After doing this for thousands of times each day, the database get corrupted and you have to compact and repair it.
I have seen this many times and its just annoying for the customer.
I am using MS Access 2003 and Microsoft Visual Studio 2005 and using RecordSets
m_pApbLogSet is dynamically allocated memory to a MS Access Table.
Has anybody had problems like corrupted database base before?
Oh, on SQL, there is NO problems the with above code
Thanks in advance
Craig
I have a program in C++ that uses MS Access database. When I need to lookup a database entry, I requery the database. When I requery the database a lot, the database gets corrupted, why. Here are some details below:
m_pApbLogSet->m_MyParam = 1;
m_pApbLogSet->m_nParams = 1;
m_pApbLogSet->m_strFilter = _T("Card = ?");
m_pApbLogSet->m_CardParam = CardNumber;
try
{
m_pApbLogSet->Requery();
}
catch(CDBException * e)
{
e->Delete();
}
if(m_pApbLogSet->IsBOF() && m_pApbLogSet->IsEOF())
{
return; //not found
// or sometimes I add a new record because the above was not found...other code in the program (m_pAPbLogSet->AddNew(); )
}
I set the filter to a card number (in this case) and run the Requery(). After doing this for thousands of times each day, the database get corrupted and you have to compact and repair it.
I have seen this many times and its just annoying for the customer.
I am using MS Access 2003 and Microsoft Visual Studio 2005 and using RecordSets
m_pApbLogSet is dynamically allocated memory to a MS Access Table.
Has anybody had problems like corrupted database base before?
Oh, on SQL, there is NO problems the with above code
Thanks in advance
Craig
Last edited: