#Max no of CRecordsets?
11-Jul-94 07:39:08
Sb: #30291-#Max no of CRecordsets?
Fm: NANOsystems Messtec 100336,1446
To: Rondal C. Ellifritt 100023,3222
Well, I have found a solution for my problem (it was in the KBase. Search for
CRecordset).
There is a bug in the CRecordset destructor. Each CRecordset::Open call creates
a temporary file in the TEMP directory (at least the access odbc driver does).
If you delete your CRecordset derived object before explicitly closing it, the
connection to the data base does not close correctly, and the temp file remains
open. If you create and delete CRecordset objects dynamically, this very soon
causes a 'number of files overflow', giving very strange errors.
Solution: Derive a class CMyRecordset and overload the destructor:
class CMyRecordset : public CRecordset
{
public:
virtual ~CMyRecordset() { Close(); }
};
This will close and remove the temp file. And plan one file handle per open
CRecordset object.
Norbert