CompuServe Thread

Max no of CRecordsets?

3 messages in this thread
#30291From: Rondal C. EllifrittJul 8, 1994 11:55 AM
Dan: This is a question which interests me as well. Though I haven't hit the problem yet, if it is actually as Norbert describes, I will hit it soon. Unfortunately, there is no article Q115516 in either the MS Developer Knowledgebase (MDKB) or the MS Knowledgebase (MSKB). What gives? Rondal Ellifritt
#30488From: NANOsystems MesstecJul 11, 1994 7:39 AM
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
#30582From: Rondal C. EllifrittJul 11, 1994 7:52 PM
Thanks, Norbert. Now that you explain it, I'm not sure I will run into this problem, but it's nice to know the solution in case I do.